Posts Tagged ‘Search’

Integrating Search in Active Scaffold is very easy

In controller we need to write the following code to make it work:

Considering the category we have

active_scaffold :category do |config|

config.label = “Category” # Display page name

config.columns = [:name, :rank, :description, :products]

config.columns[:name].label = “Some Name”

update.columns.exclude :rank # exclude rank column during edit

# Search the list by name

config.columns[:name].search_sql = “name”

config.search.columns << :name

# Search the list by product name

config.columns[:products].search_sql = “products.name”

config.search.columns << :products


We can search both the parent and child i.e Category and Product names in the same page.

Read Full Post »