{"action":"created","issue":{"url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/418","labels_url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/418/labels{/name}","comments_url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/418/comments","events_url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/418/events","html_url":"https://github.com/activescaffold/active_scaffold/issues/418","id":65375705,"number":418,"title":"belongs_to :owner, ->{ where dept : 'xxx' } not showing up in create and search dropdowns","user":{"login":"kranthi3896","id":11405911,"avatar_url":"https://avatars.githubusercontent.com/u/11405911?v=3","gravatar_id":"","url":"https://api.github.com/users/kranthi3896","html_url":"https://github.com/kranthi3896","followers_url":"https://api.github.com/users/kranthi3896/followers","following_url":"https://api.github.com/users/kranthi3896/following{/other_user}","gists_url":"https://api.github.com/users/kranthi3896/gists{/gist_id}","starred_url":"https://api.github.com/users/kranthi3896/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kranthi3896/subscriptions","organizations_url":"https://api.github.com/users/kranthi3896/orgs","repos_url":"https://api.github.com/users/kranthi3896/repos","events_url":"https://api.github.com/users/kranthi3896/events{/privacy}","received_events_url":"https://api.github.com/users/kranthi3896/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-31T06:08:03Z","updated_at":"2015-04-01T12:52:58Z","closed_at":null,"body":"the where function is working in the showing table ui. but it is not working on create and search columns for drop down."},"comment":{"url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/comments/88467735","html_url":"https://github.com/activescaffold/active_scaffold/issues/418#issuecomment-88467735","issue_url":"https://api.github.com/repos/activescaffold/active_scaffold/issues/418","id":88467735,"user":{"login":"scambra","id":20515,"avatar_url":"https://avatars.githubusercontent.com/u/20515?v=3","gravatar_id":"","url":"https://api.github.com/users/scambra","html_url":"https://github.com/scambra","followers_url":"https://api.github.com/users/scambra/followers","following_url":"https://api.github.com/users/scambra/following{/other_user}","gists_url":"https://api.github.com/users/scambra/gists{/gist_id}","starred_url":"https://api.github.com/users/scambra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scambra/subscriptions","organizations_url":"https://api.github.com/users/scambra/orgs","repos_url":"https://api.github.com/users/scambra/repos","events_url":"https://api.github.com/users/scambra/events{/privacy}","received_events_url":"https://api.github.com/users/scambra/received_events","type":"User","site_admin":false},"created_at":"2015-04-01T12:52:58Z","updated_at":"2015-04-01T12:52:58Z","body":"It would be something like this:\r\n\r\n```ruby\r\ndef association_klass_scoped(association, klass, record)\r\n    if association.name == :whole\r\n      super.where ['field_maps.id IN (?)', FieldMap.where(type_name:'INT').ids]\r\n   elsif association.name == :num\r\n      super.where ['field_maps.id IN (?)', FieldMap.where(type_name:'INT').ids]\r\n    elsif association.name == :denom\r\n      super.where ['field_maps.id IN (?)', FieldMap.where(type_name:'INT').ids]\r\n    elsif association.name == :fpoint\r\n      super.where ['field_maps.id IN (?)', FieldMap.where(type_name:'FLOAT').ids]\r\n    elsif association.name == :opti\r\n      super.where ['field_maps.id IN (?)', FieldMap.where(type_name:'OPTI_PRICE').ids]\r\n    elsif association.name == :double\r\n      super.where ['field_maps.id IN (?)', FieldMap.where(type_name:'DOUBLE').ids]\r\n    else\r\n      super\r\n    end\r\n  end\r\n```\r\n\r\nassociation_klass_scoped must return an ActiveRecord class or relation, so you can use scopes, includes, joins there too"}}