{"id":29899366,"url":"https://github.com/patorash/simple_group","last_synced_at":"2025-10-06T11:10:35.379Z","repository":{"id":30164462,"uuid":"33714770","full_name":"patorash/simple_group","owner":"patorash","description":"simple_group is able to add group function to ActiveRecord.","archived":false,"fork":false,"pushed_at":"2025-06-19T04:53:39.000Z","size":67,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-21T18:26:28.759Z","etag":null,"topics":["activerecord","ruby"],"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/patorash.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-04-10T07:26:01.000Z","updated_at":"2025-06-19T04:53:42.000Z","dependencies_parsed_at":"2022-07-21T08:49:36.468Z","dependency_job_id":null,"html_url":"https://github.com/patorash/simple_group","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/patorash/simple_group","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patorash%2Fsimple_group","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patorash%2Fsimple_group/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patorash%2Fsimple_group/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patorash%2Fsimple_group/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patorash","download_url":"https://codeload.github.com/patorash/simple_group/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patorash%2Fsimple_group/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278598620,"owners_count":26013291,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ruby"],"created_at":"2025-08-01T12:33:50.131Z","updated_at":"2025-10-06T11:10:35.353Z","avatar_url":"https://github.com/patorash.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple_group\n\nsimple_group gem is able to add group function to ActiveRecord.\n\n[![Test](https://github.com/patorash/simple_group/actions/workflows/test.yml/badge.svg)](https://github.com/patorash/simple_group/actions/workflows/test.yml)\n\n[![Code Climate](https://codeclimate.com/github/patorash/simple_group/badges/gpa.svg)](https://codeclimate.com/github/patorash/simple_group)\n[![Test Coverage](https://codeclimate.com/github/patorash/simple_group/badges/coverage.svg)](https://codeclimate.com/github/patorash/simple_group)\n\n## Installation\n\n### Rails 5.0+\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'simple_group'\n```\n\nAnd then execute:\n\n    $ bundle install\n\n### Database Migrations\n\nsimple_group uses a simple_group_combinations table to store all group information.\nTo genarate and run the migration just use.\n\n    $ bin/rails g simple_group:migration\n    $ bin/rake db:migrate\n\n## Usage\n\n### Group item model\n\nAnimal model\n\n```ruby\nclass Animal \u003c ActiveRecord::Base\n  groupable\n  validates :name, presence: true\nend\n```\n\nFruit model\n\n```ruby\nclass Fruit \u003c ActiveRecord::Base\n  groupable\n  validates :name, presence: true\nend\n```\n\n\n### Group model\n\n```ruby\nclass MyGroup \u003c ActiveRecord::Base\n  add_group_function\n\n  validates :name, presence: true\n  validates :user, presence: true\nend\n```\n\n### Example\n\n```ruby\nuser = User.create(name: 'Taro')\ngroup = MyGroup.create(name: 'Animals', user: user)\n\n# group add a dog\ndog = Animal.create(name: 'dog')\ngroup.add(dog)\n\n# cat add to group\ncat = Animal.create(name: 'cat')\ncat.add_to_group(group)\n\n# group remove a dog\ngroup.remove(dog)\n\n# item list in group\ngroup.group_items\n\n# Only animal\ngroup.for_type(Animal)\n\n# Only fruit\ngroup.for_type(Fruit)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, 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` to 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\n1. Fork it ( https://github.com/patorash/simple_group/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatorash%2Fsimple_group","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatorash%2Fsimple_group","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatorash%2Fsimple_group/lists"}