{"id":19973860,"url":"https://github.com/plainsource/activekit","last_synced_at":"2026-02-08T23:36:23.294Z","repository":{"id":200424932,"uuid":"705466533","full_name":"plainsource/activekit","owner":"plainsource","description":"The essential kit for rails ActiveRecord models to be happy.","archived":false,"fork":false,"pushed_at":"2024-12-10T01:13:35.000Z","size":153,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T01:42:23.940Z","etag":null,"topics":["activemodel","activerecord","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/plainsource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","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":"2023-10-16T04:09:20.000Z","updated_at":"2024-12-10T01:12:06.000Z","dependencies_parsed_at":"2024-04-24T12:30:51.406Z","dependency_job_id":"1efc39ce-b894-4b52-9080-c2742ab0d8b6","html_url":"https://github.com/plainsource/activekit","commit_stats":null,"previous_names":["plainsource/activekit"],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plainsource%2Factivekit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plainsource%2Factivekit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plainsource%2Factivekit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plainsource%2Factivekit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plainsource","download_url":"https://codeload.github.com/plainsource/activekit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252036066,"owners_count":21684229,"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":["activemodel","activerecord","rails","ruby"],"created_at":"2024-11-13T03:13:13.452Z","updated_at":"2026-02-08T23:36:20.123Z","avatar_url":"https://github.com/plainsource.png","language":"Ruby","readme":"# ActiveKit\nAdd the essential kit for rails ActiveRecord models and be happy.\n\n## Usage\n\n### Search Attribute\n\nAdd searching to your ActiveRecord models.\nSearch Attribute provides full searching functionality for your model database records using redis search including search suggestions.\n\nYou can define any number of model attributes in one model to search together.\n\nDefine the search attributes in accordance with the column name in your model like below.\n```ruby\nclass Product \u003c ApplicationRecord\n  search_attribute :name, type: :text\n  search_attribute :permalink, type: :tag\n  search_attribute :short_description, type: :text\n  search_attribute :published, type: :tag, sortable: true\nend\n```\n\nYou can also define a search_describer to describe the details of the search instead of using the defaults.\n```ruby\nclass Product \u003c ApplicationRecord\n  # search_describer method_name, database: -\u003e { ActiveRecord::Base.connection_db_config.database }\n  search_describer :limit_by_search, database: -\u003e { System::Current.tenant.database }\n  search_attribute :name, type: :text\n  search_attribute :permalink, type: :tag\n  search_attribute :short_description, type: :text\n  search_attribute :published, type: :tag, sortable: true\nend\n```\n\nThe following class methods will be added to your model class to use in accordance with details provided for search_describer:\n```ruby\nProduct.limit_by_search(term: \"term\", tags: { published: true }, order: \"name asc\", page: 1)\nProduct.searcher.for(:limit_by_search).current_page\nProduct.searcher.for(:limit_by_search).previous_page?\nProduct.searcher.for(:limit_by_search).previous_page\nProduct.searcher.for(:limit_by_search).next_page?\nProduct.searcher.for(:limit_by_search).next_page\nProduct.searcher.for(:limit_by_search).suggestions(prefix: \"prefix_term\").keys\n```\n\n### Export Attribute\n\nAdd exporting to your ActiveRecord models.\nExport Attribute provides full exporting functionality for your model database records.\n\nYou can define any number of model attributes and association attributes in one model to export together.\n\nDefine the export attributes in accordance with the column name in your model like below.\n```ruby\nclass Product \u003c ApplicationRecord\n  export_attribute :name\n  export_attribute :sku, heading: \"SKU No.\"\n  export_attribute :image_name, value: lambda { |record| record.image\u0026.name }, includes: :image\n  export_attribute :variations, value: lambda { |record| record.variations }, includes: :variations, attributes: [:name, :price, discount_value: { heading: \"Discount\" }]\nend\n```\n\nYou can also define an export_describer to describe the details of the export instead of using the defaults.\n```ruby\nclass Product \u003c ApplicationRecord\n  # export_describer method_name, kind: :csv, database: -\u003e { ActiveRecord::Base.connection_db_config.database }\n  export_describer :to_csv, kind: :csv, database: -\u003e { System::Current.tenant.database }\n  export_attribute :name\n  export_attribute :sku, heading: \"SKU No.\"\n  export_attribute :image_name, value: lambda { |record| record.image\u0026.name }, includes: :image\n  export_attribute :variations, value: lambda { |record| record.variations }, includes: :variations, attributes: [:name, :price, discount_value: { heading: \"Discount\" }]\nend\n```\n\nThe following class methods will be added to your model class to use in accordance with details provided for export_describer:\n```ruby\nProduct.to_csv\n```\n\n### Position Attribute\n\nAdd positioning to your ActiveRecord models.\nPosition Attribute provides full positioning functionality using lexicographic ordering for your model database records.\n\nYou can also add multiple position attributes in one model to store different arrangements.\n\nJust create a database column in your model with type :string having an index.\n```ruby\nadd_column :products, :arrangement, :string\nadd_index  :products, :arrangement\n```\n\nThen define the column name in your model like below.\n```ruby\nclass Product \u003c ApplicationRecord\n  position_attribute :arrangement\nend\n```\n\nCreating the record will automatically set it to the last position:\n```ruby\nproduct = Product.create(name: \"Nice Product\")\n```\n\nThe following attribute methods will be added to your model object to use:\n```ruby\nproduct.arrangement_position = 1 # Set the position\nproduct.arrangement_position # Access the manually set position\nproduct.arrangement_position_in_database # Check the position as per database\nproduct.arrangement_position_options # Can be used in dropdown\nproduct.arrangement_position_maximum # Check current maximum position\n```\n\nThe following class methods will be added to your model class to use:\n```ruby\n# If a database table already has existing rows, run this to set initial values.\n# You can also run this to manually harmonize a position attribute column.\nProduct.harmonize_arrangement!\n```\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'active_kit'\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install active_kit\n```\n\n## Contributing\nContribution directions go here.\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplainsource%2Factivekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplainsource%2Factivekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplainsource%2Factivekit/lists"}