{"id":14446732,"url":"https://github.com/ManageIQ/activerecord-virtual_attributes","last_synced_at":"2025-08-28T02:30:31.810Z","repository":{"id":34243150,"uuid":"167454197","full_name":"ManageIQ/activerecord-virtual_attributes","owner":"ManageIQ","description":"VirtualAttributes allows you to define a ruby method that acts like an attribute or relation.","archived":false,"fork":false,"pushed_at":"2024-11-11T14:42:28.000Z","size":536,"stargazers_count":9,"open_issues_count":15,"forks_count":12,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-13T04:38:52.286Z","etag":null,"topics":["activerecord","activerecord-extension","hacktoberfest","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ManageIQ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-24T23:35:35.000Z","updated_at":"2024-11-11T14:42:33.000Z","dependencies_parsed_at":"2022-08-09T22:40:09.161Z","dependency_job_id":"dcf57528-824e-4e02-951e-f3de8d08d6ec","html_url":"https://github.com/ManageIQ/activerecord-virtual_attributes","commit_stats":{"total_commits":313,"total_committers":19,"mean_commits":"16.473684210526315","dds":"0.31948881789137384","last_synced_commit":"d91b1240bde803262755644ff350d12ac2de6842"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManageIQ%2Factiverecord-virtual_attributes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManageIQ%2Factiverecord-virtual_attributes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManageIQ%2Factiverecord-virtual_attributes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManageIQ%2Factiverecord-virtual_attributes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ManageIQ","download_url":"https://codeload.github.com/ManageIQ/activerecord-virtual_attributes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231209343,"owners_count":18342311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activerecord","activerecord-extension","hacktoberfest","ruby"],"created_at":"2024-09-01T07:01:05.410Z","updated_at":"2024-12-25T08:30:22.646Z","avatar_url":"https://github.com/ManageIQ.png","language":"Ruby","readme":"# VirtualAttributes\n\n[![CI](https://github.com/ManageIQ/activerecord-virtual_attributes/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/activerecord-virtual_attributes/actions/workflows/ci.yaml)\n[![Maintainability](https://codeclimate.com/github/ManageIQ/activerecord-virtual_attributes.svg)](https://codeclimate.com/github/ManageIQ/activerecord-virtual_attributes/maintainability)\n[![Test Coverage](https://codeclimate.com/github/ManageIQ/activerecord-virtual_attributes/coverage.svg)](https://codeclimate.com/github/ManageIQ/activerecord-virtual_attributes/test_coverage)\n\nVirtualAttributes allows you to define a ruby method that acts like an attribute or relation.\n\nSometimes you have a model with an attribute defined in ruby but you want to sort or filter by it. Filtering by that attribute necessitates fetching all the rows from the database and filtering in ruby. For large tables, this is slow and takes up a lot of memory.\n\nThis gem allows you to represent these attributes in sql so `ORDER BY` `WHERE` clauses will work.\n\nThis also allows you to calculate counts and treat those as a field accessible with `select(:child_count)` to get rid of the N+1 problem of running a `count(*)` on a subcollection for each row.\n\n## Versioning\n\nAs of v6.1.0, the versioning of this gem follows ActiveRecord versioning, and does not follow SemVer (e.g. virtual attributes v6.1.x supports all versions of Rails 6.1). Version v3.0.0 supports Rails 6.0 and lower.\n\nUse the latest version of both this gem and Rails where the first 2 digits match.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'activerecord-virtual_attributes'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install activerecord-virtual_attributes\n\n## Usage\n\nTODO: Write usage instructions here\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\nTo test with different database adapters, set the DB environment variable:\n\n    DB=postgresql bundle exec rake\n    DB=mysql bundle exec rake\n    DB=sqlite3 bundle exec rake\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/ManageIQ/activerecord-virtual_attributes .\n\n## License\n\nThis project is available as open source under the terms of the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FManageIQ%2Factiverecord-virtual_attributes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FManageIQ%2Factiverecord-virtual_attributes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FManageIQ%2Factiverecord-virtual_attributes/lists"}