{"push_id":1875339643,"size":2,"distinct_size":2,"ref":"refs/heads/276-collection_filters","head":"1e16c18378dd7f257d795dfade24f79f5b358023","before":"83bb76540eceed27d160d3da717239f0cb84d0cc","commits":[{"sha":"1e75d6fa93ca250dc6ee4cd65a46b2fd82972e09","author":{"name":"Jakob Skjerning","email":"17d3c251b013cdb52ecefc0d9ef1a254297af19e@mentalized.net"},"message":"Only search for actually defined filters\n\nArbitrarily calling code sent in from search queries probably isn't the wisest\nidea.","distinct":true,"url":"https://api.github.com/repos/substancelab/administrate/commits/1e75d6fa93ca250dc6ee4cd65a46b2fd82972e09"},{"sha":"1e16c18378dd7f257d795dfade24f79f5b358023","author":{"name":"Jakob Skjerning","email":"17d3c251b013cdb52ecefc0d9ef1a254297af19e@mentalized.net"},"message":"Configure filters using lambdas\n\nWhile a more verbose syntax, this allows us to define filters specifically for\nuse in Administrate without having to clutter the resource classes with scopes.\n\nIe, there is no need to add both\n\n    # app/models/customer.rb\n    scope :inactive, -> { where(\"login_at < ?\", 1.week.ago) }\n\n    # app/dashboards/customer_dashboard.rb\n    COLLECTION_FILTERS = [:inactive]\n\nto your application models when the scope is something you only need in\nAdministrate. Instead, you can add it directly to the dashboard class:\n\n    COLLECTION_FILTERS = {\n      inactive: ->(resources) { resources.where(\"login_at < ?\", 1.week.ago) }\n    }\n\nand achieve the same effect. This in no way restricts you from using already\ndefined scopes, though, so if you already had the `inactive` scope you would\ndefine the filter like so:\n\n    COLLECTION_FILTERS = {\n      inactive: ->(resources) { resources.inactive }\n    }\n\nThis still allows us to add the simpler syntax in a backwards compatible way at\nsome point down the line if we feel the need. For example it could end up looking like:\n\n    COLLECTION_FILTERS = {\n      vip: :vip, # This calls the method `vip` on resources\n      inactive: ->(resources) { resources.where(\"login_at < ?\", 1.week.ago) }\n    }\n\nbut that's a step I am not ready to take.","distinct":true,"url":"https://api.github.com/repos/substancelab/administrate/commits/1e16c18378dd7f257d795dfade24f79f5b358023"}]}
{"actor":{"display_login":"koppen"}}