On Lunes, 23 de enero de 2012 10:00:13 Tin Vo escribió:
> Thank you for your help; but I'm getting the error:
> ActiveRecord::ConfigurationError (Association named 'location_language' was
> not found
> Please note that for the 'Courses' table, there's no such association; it
> has an association called "course_languages".

I understood you that you want to add to course languages table. Change it to:
config.columns[:language].includes = {:course_languages => {:location_language 
=> :language}}



> 
> -Tin
> 
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of Sergio Cambra
> > Sent: Monday, January 23, 2012 3:04 AM
> > To: [email protected]
> > Subject: Re: Stuck with field searching of association
> > 
> > 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.

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