It's all about rebinding. Forget about record_select. I've just made
yet one association:

such code:

belongs_to :teaching_place
belongs_to :fake_teaching_place_association, :class_name =>
'TeachingPlace', :foreign_key => 'teaching_place_id'

 with fake association doesn't helps - no field in update form( to be
precise it appers and disappears chaotic depends on sever restart,
login/logout)
Is there any suggestion for moving nested records from one parent to another?


2010/9/27 Sergio Cambra .:: entreCables S.L. ::. <[email protected]>:
> I suppose query is find all from line 10, because you didn't send the
> backtrace. It must be a ActiveRecord bug, or postgres adapter bug.
> RecordSelect only is issuing a query with conditions and includes. You can
> define record_select_select to override select option in find query (default 
> is
> *) I can't reproduce it with mysql
>
> On Lunes, 27 de Septiembre de 2010 02:05:21 Andrey Voronkov escribió:
>> I've added
>>
>> def record_select_includes
>>
>>  :lecturer
>>
>> end
>>
>> to the TeachingPlace model and now I'm getting this error:
>>
>> TeachingPlace Load IDs For Limited Eager Loading (0.0ms)   PGError:
>> ERROR: column reference "id" is ambiguous
>> LINE 1: ...T ON ("teaching_places".id) "teaching_places".id, id AS alia...
>>  ^
>>
>> : SELECT * FROM (SELECT DISTINCT ON ("teaching_places".id)
>>
>> "teaching_places".id, id AS alias_0 FROM "teaching_places" LEFT OUTER
>> JOIN "lecturers" ON "lecturers".id = "teaching_places".lecturer_id
>> WHERE (((lecturers.name LIKE 'asdf%'))) ) AS id_list ORDER BY
>> id_list.alias_0 LIMIT 10 OFFSET 0
>>
>> ActionView::TemplateError (PGError: ERROR:  column reference "id" is
>> ambiguous LINE 1: ...T ON ("teaching_places".id) "teaching_places".id, id
>> AS alia... ^
>>
>> : SELECT * FROM (SELECT DISTINCT ON ("teaching_places".id)
>>
>> "teaching_places".id, id AS alias_0 FROM "teaching_places"  LEFT OUTER
>> JOIN "lecturers" ON "lecturers".id = "teaching_places".lecturer_id
>> WHERE (((lecturers.name LIKE 'asdf%'))) ) AS id_list ORDER BY
>> id_list.alias_0  LIMIT 10 OFFSET 0) on line #19 of
>> vendor/plugins/recordselect/app/views/record_select/_list.html.erb:
>> 16:                       {:href => prev_url} %>
>>
>> 2010/9/24 Sergio Cambra .:: entreCables S.L. ::. <[email protected]>:
>> > 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.
>
> --
> 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.
>
>

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