{"id":19446024,"url":"https://github.com/nerdgeschoss/document_serializable","last_synced_at":"2025-04-25T01:31:56.269Z","repository":{"id":59152983,"uuid":"82547199","full_name":"nerdgeschoss/document_serializable","owner":"nerdgeschoss","description":"Serialize document based data into your ActiveRecord objects","archived":false,"fork":false,"pushed_at":"2017-04-06T11:08:43.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-04T07:05:33.441Z","etag":null,"topics":["activerecord","json","mongodb","postgres","rails","ruby"],"latest_commit_sha":null,"homepage":"","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/nerdgeschoss.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":"2017-02-20T10:45:54.000Z","updated_at":"2023-05-05T20:30:10.000Z","dependencies_parsed_at":"2022-09-13T11:01:13.352Z","dependency_job_id":null,"html_url":"https://github.com/nerdgeschoss/document_serializable","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdgeschoss%2Fdocument_serializable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdgeschoss%2Fdocument_serializable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdgeschoss%2Fdocument_serializable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdgeschoss%2Fdocument_serializable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nerdgeschoss","download_url":"https://codeload.github.com/nerdgeschoss/document_serializable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223976230,"owners_count":17234751,"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","json","mongodb","postgres","rails","ruby"],"created_at":"2024-11-10T16:12:30.134Z","updated_at":"2024-11-10T16:12:30.760Z","avatar_url":"https://github.com/nerdgeschoss.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DocumentSerializable\n\n[![CircleCI](https://circleci.com/gh/nerdgeschoss/document_serializable/tree/master.svg?style=svg)](https://circleci.com/gh/nerdgeschoss/document_serializable/tree/master)\n\nSerialize your object hierarchy in a document based style to your relational database via virtus.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'document_serializable'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install document_serializable\n\n## Usage\n\nDefine your model:\n\n```bash\nrails g model Invoice properties:jsonb:index\n```\n\n```ruby\nclass Address\n  include Virtus.model\n\n  attribute :name\n  attribute :city\nend\n\nclass Invoice \u003c ApplicationRecord\n  include DocumentSerializable\t\n\n  attribute address, Address\n  attribute subject\nend\n```\n\nThen initialize it with content and access attributes directly from your model:\n\n```ruby\ninvoice = Invoice.new subject: \"Pay me!\", address: { name: \"Jon Doe\", city: \"New York\" }\ninvoice.address.name # Jon Doe\ninvoice.subject # Pay me!\ninvoice.save!\n```\n\nThis works for all models that have a serialized attribute named `properties` (e.g. json column in MySQL or jsonb in Postgres).\n\nYou can also query for properties (in Postgres):\n\n```ruby\nInvoice.where(\"properties @\u003e ?\", { address: { city: \"New York\" } }.to_json)\n```\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/Alex/document_serializable.\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%2Fnerdgeschoss%2Fdocument_serializable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnerdgeschoss%2Fdocument_serializable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdgeschoss%2Fdocument_serializable/lists"}