Benjamin Curtis

Speculations on Web Development

Missing Attr_unsearchable in Ransack?

| Comments

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

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