On Viernes, 24 de Septiembre de 2010 07:27:07 Andrey Voronkov escribió:
> RecordSelect is confifured this way:
>
> class DeptHead::TeachingPlacesController < DeptHead::BaseController
>   record_select :search_on => 'lecturers.name', :include => :lecturer
> ...
>
> Record select field displaying whole list of teaching places but when
> I start to fill this field to filter results I get this:
>
> PGError: ERROR: missing FROM-clause entry for table "lecturers"
> LINE 1: ...t(*) AS count_all FROM "teaching_places" WHERE (((lecturers....
>  ^
>
> : SELECT count(*) AS count_all FROM "teaching_places" WHERE
>
> (((lecturers.name LIKE 'sadfsadf%')))
>
> ActiveRecord::StatementInvalid (PGError: ERROR:  missing FROM-clause
> entry for table "lecturers"
> LINE 1: ...t(*) AS count_all FROM "teaching_places" WHERE (((lecturers....
>
> Can anybody tell me what's the problem?

Looking at record_select code, config.include is only used in find query, but 
it 
isn't used in count query. You can use config.include to get fields from 
associations to customize the view. If you want to search in other table, you 
have to override record_select_includes with that association, because is used 
in count and find all queries.

def record_select_includes
  :lecturer
end

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