Missing attr_unsearchable in ransack?

If you are upgrading to ransack from meta_search, and you are missing being able to use attr_unsearchable to hide various model methods from search, you can add this to your model instead:

def self.ransackable_attributes(auth_object = nil)
  (column_names - ['company_name']) + _ransackers.keys
end

In this case, company_name will no longer be searchable with the dynamic scopes that ransack creates.

Comments