{"action":"created","issue":{"url":"https://api.github.com/repos/activeadmin/activeadmin/issues/4121","labels_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/4121/labels{/name}","comments_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/4121/comments","events_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/4121/events","html_url":"https://github.com/activeadmin/activeadmin/issues/4121","id":106812080,"number":4121,"title":"invalid ","user":{"login":"mwlang","id":18387,"avatar_url":"https://avatars.githubusercontent.com/u/18387?v=3","gravatar_id":"","url":"https://api.github.com/users/mwlang","html_url":"https://github.com/mwlang","followers_url":"https://api.github.com/users/mwlang/followers","following_url":"https://api.github.com/users/mwlang/following{/other_user}","gists_url":"https://api.github.com/users/mwlang/gists{/gist_id}","starred_url":"https://api.github.com/users/mwlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwlang/subscriptions","organizations_url":"https://api.github.com/users/mwlang/orgs","repos_url":"https://api.github.com/users/mwlang/repos","events_url":"https://api.github.com/users/mwlang/events{/privacy}","received_events_url":"https://api.github.com/users/mwlang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-16T16:38:26Z","updated_at":"2015-10-13T22:59:58Z","closed_at":null,"body":"On master branch and RoR 4.1.19, I have the following Order:\r\n\r\n~~~ruby\r\nActiveAdmin.register Order do\r\n  filter :payment_type\r\n  # irrelevant code redacted ...  \r\nend\r\n~~~\r\n\r\nThe Order model: \r\n\r\n~~~ruby\r\n# +-----------------------------------------+---------------+------+-----+---------+----------------+\r\n# | Field                                   | Type          | Null | Key | Default | Extra          |\r\n# +-----------------------------------------+---------------+------+-----+---------+----------------+\r\n# | id                                      | int(11)       | NO   | PRI | NULL    | auto_increment |\r\n# | payment_type_code                       | varchar(31)   | YES  |     | NULL    |                |\r\n# +-----------------------------------------+---------------+------+-----+---------+----------------+\r\nclass Order < ActiveRecord::Base\r\n  belongs_to  :payment_type,      \r\n      :class_name => \"PaymentType\",   \r\n      :foreign_key => \"payment_type_code\"\r\n  # irrelevant code redacted ...  \r\nend\r\n~~~\r\n\r\nWhen visiting the Orders page, the following error is raised:\r\n\r\n~~~\r\nundefined method `payment_type_code_eq_eq_eq_eq_eq' for Ransack::Search<class: Order, base: Grouping <combinator: and>>:Ransack::Search\r\n~~~\r\nIf visited a subsequent time, the \"_eq\" is appended even more!\r\n~~~\r\nundefined method `payment_type_code_eq_eq_eq_eq_eq_eq_eq_eq_eq_eq' for Ransack::Search<class: Order, base: Grouping <combinator: and>>:Ransack::Search\r\n~~~\r\n\r\nThe following monkey patch resolves:\r\n~~~ruby\r\nmodule ActiveAdmin\r\n  module Inputs\r\n    module Filters\r\n      class SelectInput < ::Formtastic::Inputs::SelectInput\r\n        def input_name\r\n          return method if seems_searchable?\r\n          if searchable_method_name.ends_with?(\"_eq\") || searchable_method_name.ends_with?(\"_in\")\r\n            return searchable_method_name \r\n          end\r\n          searchable_method_name.concat multiple? ? '_in' : '_eq'\r\n        end\r\n      end\r\n    end\r\n  end\r\nend\r\n~~~\r\nThis patch basically preempts adding \"_in\" or \"_eq\" if it already exists on the name."},"comment":{"url":"https://api.github.com/repos/activeadmin/activeadmin/issues/comments/147877764","html_url":"https://github.com/activeadmin/activeadmin/issues/4121#issuecomment-147877764","issue_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/4121","id":147877764,"user":{"login":"mwlang","id":18387,"avatar_url":"https://avatars.githubusercontent.com/u/18387?v=3","gravatar_id":"","url":"https://api.github.com/users/mwlang","html_url":"https://github.com/mwlang","followers_url":"https://api.github.com/users/mwlang/followers","following_url":"https://api.github.com/users/mwlang/following{/other_user}","gists_url":"https://api.github.com/users/mwlang/gists{/gist_id}","starred_url":"https://api.github.com/users/mwlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwlang/subscriptions","organizations_url":"https://api.github.com/users/mwlang/orgs","repos_url":"https://api.github.com/users/mwlang/repos","events_url":"https://api.github.com/users/mwlang/events{/privacy}","received_events_url":"https://api.github.com/users/mwlang/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T22:59:58Z","updated_at":"2015-10-13T22:59:58Z","body":"@seanlinsley yes, that's actually what I ended up doing once I realized what was really happening and forgot to come back to this ticket with an update."}}