{"id":15821195,"url":"https://github.com/flexoid/mongoid_filter","last_synced_at":"2025-04-01T18:30:49.067Z","repository":{"id":7823678,"uuid":"9194703","full_name":"flexoid/mongoid_filter","owner":"flexoid","description":null,"archived":false,"fork":false,"pushed_at":"2013-04-11T22:41:44.000Z","size":142,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-14T23:46:24.987Z","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/flexoid.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":"2013-04-03T13:04:38.000Z","updated_at":"2013-11-04T09:55:27.000Z","dependencies_parsed_at":"2022-08-28T05:41:42.332Z","dependency_job_id":null,"html_url":"https://github.com/flexoid/mongoid_filter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexoid%2Fmongoid_filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexoid%2Fmongoid_filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexoid%2Fmongoid_filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexoid%2Fmongoid_filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flexoid","download_url":"https://codeload.github.com/flexoid/mongoid_filter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246635949,"owners_count":20809331,"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-10-05T07:20:56.403Z","updated_at":"2025-04-01T18:30:48.811Z","avatar_url":"https://github.com/flexoid.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoidFilter\n\nTODO: Write a gem description\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'mongoid_filter'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install mongoid_filter\n\n## Usage\n\n### Example\n\n#### Model\n```ruby\nclass Log\n  include Mongoid::Document\n  include MongoidFilter\n\n  field :event_type,  type: String\n  field :status,      type: Boolean\n\n  # It will allow us to filter by this three fields\n  can_filter_by :event_type, :status, :created_at\n\n  # Specify custom method to create object from params\n  special_filter :created_at, -\u003e(date) { Date.strptime(date, '%m/%d/%Y') }\nend\n```\n#### Controller\n```ruby\n@logs = Log.where(user_id: user.id).filter_by(params[:search])\n```\n\n#### View\n```erb\n\u003c%= form_for @request_logs.filter_form_object, as: :search do |f| %\u003e\n  \u003c%= f.select :event_type_eq, Log.event_types %\u003e\n  \u003c%= f.select :status_eq, Log.statuses %\u003e\n  \u003c%= f.text_area :created_at_gt %\u003e\n\u003c% end %\u003e\n```\n\n## Contributing\n\n1. Fork it\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 new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexoid%2Fmongoid_filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflexoid%2Fmongoid_filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexoid%2Fmongoid_filter/lists"}