On Martes, 24 de Mayo de 2011 02:25:19 Richard Zheng escribió:
> Hi,
> 
> I have looked into
> https://github.com/activescaffold/active_scaffold/wiki/Search-on-second-ord
> er-association. But still not sure how to do what I need.
> 
> Company has_many employees. A search on company needs to search fields in
> company and also employees'. We are particularly interested in field
> first_name, last_name, office_phone and cell_phone in table employees.
> Would something like the following work?
> 
> class CompaniesController < ApplicationController
> 
>   config.search.columns << :employee
> config.columns[:employee].search_sql = "employees.first_name" ### how to
> put last_name and other field?
>  config.columns[:employee].search_ui = :string # optional
>  config.columns[:employee].options[:string_comparators] = true # optional

Try adding virtual columns to search columns and set the search_sql

> 
> end
> 
> 
> Any suggestion?
> 
> Thanks,
> Richard

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to