{"id":22394055,"url":"https://github.com/flant/serialized_virtual_attributes","last_synced_at":"2025-03-26T22:40:57.752Z","repository":{"id":56895076,"uuid":"43673300","full_name":"flant/serialized_virtual_attributes","owner":"flant","description":null,"archived":false,"fork":false,"pushed_at":"2016-02-24T15:19:20.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-23T01:02:44.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-05T08:37:28.000Z","updated_at":"2016-02-24T15:19:20.000Z","dependencies_parsed_at":"2022-08-21T01:20:14.514Z","dependency_job_id":null,"html_url":"https://github.com/flant/serialized_virtual_attributes","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flant%2Fserialized_virtual_attributes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flant%2Fserialized_virtual_attributes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flant%2Fserialized_virtual_attributes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flant%2Fserialized_virtual_attributes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flant","download_url":"https://codeload.github.com/flant/serialized_virtual_attributes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245749795,"owners_count":20666084,"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":[],"created_at":"2024-12-05T05:08:45.812Z","updated_at":"2025-03-26T22:40:57.722Z","avatar_url":"https://github.com/flant.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SerializedVirtualAttributes\n\n## Developing is dropped in favor of [activerecord-typedstore](http://github.com/byroot/activerecord-typedstore)\n\nThis gem provides ability to have several attributes in one ActiveRecord serialized column. It might be useful for STI classes, that have some different attributes and you don't want to have separate columns for each class.\n\n## Requirements\n\nThis gem requires ActiveRecord 3.0 or higher and ruby 1.9 or higher.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'serialized_virtual_attributes'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install serialized_virtual_attributes\n\n## Usage\n\nJust create text column, serialize it to `Hash` and define your virtual attributes using `serialized_virtual_attribute`:\n```ruby\n  class Server \u003c ActiveRecord::Base\n    serialize :configuration, Hash\n\n    # basic attributes\n    serialized_virtual_attribute :host, :description, to: :configuration\n\n    # attribute with typecast\n    serialized_virtual_attribute :port, to: :configuration, typecast: Integer\n\n    # attributes with prefixed accessors\n    serialized_virtual_attribute :name, to: :configuration, prefix: :network\n  end\n```\nThen you are able to use accessors:\n\n```ruby\n  serv = Server.new\n  serv.host = 'localhost'\n  serv.port = 9232\n  serv.network_name = 'oxygen'\n```\n\nFor ActiveRecord \u003c 4 attr_accessible is enabled by default. You can disable it by providing `accessible: false`.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` 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\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/flant/serialized_virtual_attributes.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflant%2Fserialized_virtual_attributes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflant%2Fserialized_virtual_attributes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflant%2Fserialized_virtual_attributes/lists"}