On Sábado, 21 de enero de 2012 17:01:46 Tin Vo escribió:
> Hello,
> 
> I'm quite new to AS; and I've been scratching my head for too long
> with this problem.  I have the following relation:
> "course.course_languages.first.location_language.language.description",
> where "courses" has many "course_languages" belongs to
> "location_language" belongs to "language"
> 
> I would like to enable field search on Courses table for column
> "course_languages" searching on "description" of the "language".
> 
> Any help is greatly appreciated.
> -Tin

Set includes and search_sql for langague virtual column 

Create virtual column:
config.columns << :language
config.columns.exclude :language
config.field_search.columns << :language

You can exclude from other actions instead of config.columns.exclude
Also, you should define language in the model to avoid exceptions:
def language
  location_language.try(:language).try(:description)
end

Set includes and search_sql:
config.columns[:language].includes = {:location_language => :language}
config.columns[:language].search_sql = 'languages.description'

-- 
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