By using acts_as_tree gem all is ok.

2010/10/6 Andrey Voronkov <[email protected]>:
> This is a successful request (where nested records are displayed) and
> I didn't change the code at all. Only start/restart server and changed
> config.cache_classes = false
> Processing FcpsController#index to html (for 127.0.0.1 at 2010-10-06
> 14:09:03) [GET]
>  Parameters: {"eid"=>"ece3727dc1ddffdcc1445e58d5c47a4d",
> "parent_column"=>"subprograms", "nested"=>true, "id"=>nil,
> "parent_model"=>"Fcp"}
>  CACHE (0.0ms)   SELECT * FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
>  Statecustomer Columns (1.6ms)   SHOW FIELDS FROM `customers`
>  SQL (0.2ms)   SELECT count(DISTINCT `programs`.id) AS count_all FROM
> `programs` LEFT OUTER JOIN `customer_programs` ON
> customer_programs.program_id = programs.id LEFT OUTER JOIN `customers`
> ON `customers`.id = `customer_programs`.customer_id AND
> (`customers`.`type` = 'Statecustomer' ) LEFT OUTER JOIN `programs`
> parents_programs ON `parents_programs`.id = `programs`.parent_id AND
> (`parents_programs`.`type` = 'Fcp' ) WHERE (((programs.parent_id =
> '138'))) AND ( (`programs`.`type` = 'Fcp' ) )
>  Fcp Load (0.2ms)   SELECT `programs`.* FROM `programs` WHERE
> (((programs.parent_id = '138'))) AND ( (`programs`.`type` = 'Fcp' ) )
> ORDER BY `programs`.`name` ASC LIMIT 0, 30
>  CustomerProgram Load (0.2ms)   SELECT `customer_programs`.* FROM
> `customer_programs` WHERE (`customer_programs`.program_id IN
> (140,175,139,141))
>  CustomerProgram Columns (1.9ms)   SHOW FIELDS FROM `customer_programs`
>  Statecustomer Load (0.2ms)   SELECT * FROM `customers` WHERE
> (`customers`.`id` IN (17,31)) AND ( (`customers`.`type` =
> 'Statecustomer' ) )
>  CACHE (0.0ms)   SELECT * FROM `programs` WHERE (`programs`.`id` =
> 138) AND ( (`programs`.`type` = 'Fcp' ) )
>
> 2010/10/6 Andrey Voronkov <[email protected]>:
>> This is a nested open request.
>>
>> Processing FcpsController#index to html (for 127.0.0.1 at 2010-10-06
>> 13:56:05) [GET]
>>  Parameters: {"parent_column"=>"subprograms",
>> "eid"=>"c7666cac28eaec93e9e7b0ab33352012", "nested"=>true, "id"=>nil,
>> "parent_model"=>"Fcp"}
>>  CACHE (0.0ms)   SELECT * FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
>>  SQL (1.7ms)   SELECT count(DISTINCT `programs`.id) AS count_all FROM
>> `programs` LEFT OUTER JOIN `customer_programs` ON
>> customer_programs.program_id = programs.id LEFT OUTER JOIN `customers`
>> ON `customers`.id = `customer_programs`.customer_id AND
>> (`customers`.`type` = 'Statecustomer' ) LEFT OUTER JOIN `programs`
>> subprograms_programs ON subprograms_programs.parent_id = programs.id
>> AND (`subprograms_programs`.`type` = 'Fcp' ) WHERE (((programs.id =
>> '137'))) AND ( (`programs`.`type` = 'Fcp' ) )
>>  Fcp Load (0.7ms)   SELECT `programs`.* FROM `programs` WHERE
>> (((programs.id = '137'))) AND ( (`programs`.`type` = 'Fcp' ) ) ORDER
>> BY `programs`.`name` ASC LIMIT 0, 30
>>  CustomerProgram Load (0.8ms)   SELECT `customer_programs`.* FROM
>> `customer_programs` WHERE (`customer_programs`.program_id = 137)
>>  Statecustomer Load (0.3ms)   SELECT * FROM `customers` WHERE
>> (`customers`.`id` = 25) AND ( (`customers`.`type` = 'Statecustomer' )
>> )
>>  Fcp Load (1.7ms)   SELECT `programs`.* FROM `programs` WHERE
>> (`programs`.parent_id = 137) AND ( (`programs`.`type` = 'Fcp' ) )
>>
>>
>> And this query in it:
>> SQL (1.7ms)   SELECT count(DISTINCT `programs`.id) AS count_all FROM
>> `programs` LEFT OUTER JOIN `customer_programs` ON
>> customer_programs.program_id = programs.id LEFT OUTER JOIN `customers`
>> ON `customers`.id = `customer_programs`.customer_id AND
>> (`customers`.`type` = 'Statecustomer' ) LEFT OUTER JOIN `programs`
>> subprograms_programs ON subprograms_programs.parent_id = programs.id
>> AND (`subprograms_programs`.`type` = 'Fcp' ) WHERE (((programs.id =
>> '137'))) AND ( (`programs`.`type` = 'Fcp' ) )
>>
>> returns self only.
>>
>> 2010/10/6 Andrey Voronkov <[email protected]>:
>>> If config.cache_classes = true
>>> In any way it displays self.
>>>
>>>
>>> 2010/10/6 Andrey Voronkov <[email protected]>:
>>>> This is a very strange bug:
>>>>
>>>> When I've logout, restarting the server and login all is ok.
>>>> When I restart server after that (without logout) I see self in nested
>>>> set. I cannot understand this behaviour.
>>>>
>>>> 2010/10/5 Andrey Voronkov <[email protected]>:
>>>>> sorry just tested now - it was some kind of cache or something else
>>>>> (strange for development environment) but now all is ok :) Sorry for
>>>>> bothering.
>>>>>
>>>>> 2010/10/5 Andrey Voronkov <[email protected]>:
>>>>>> Nested link and links on :parent and :subprograms are follows to self
>>>>>>
>>>>>> 2010/10/5 Sergio Cambra .:: entreCables S.L. ::. 
>>>>>> <[email protected]>:
>>>>>>> On Martes, 5 de Octubre de 2010 06:57:34 Andrey Voronkov escribió:
>>>>>>>> I have this model (STI from Program)
>>>>>>>> class Fcp < Program
>>>>>>>>   belongs_to :parent,
>>>>>>>>
>>>>>>>>              :class_name => 'Fcp',
>>>>>>>>              :foreign_key => 'parent_id'
>>>>>>>>
>>>>>>>>   has_many :subprograms,
>>>>>>>>
>>>>>>>>            :class_name => 'Fcp',
>>>>>>>>            :foreign_key => 'parent_id',
>>>>>>>>            :dependent => :destroy
>>>>>>>>
>>>>>>>> ...
>>>>>>>> end
>>>>>>>>
>>>>>>>> and this link in FcpController:
>>>>>>>> active_scaffold do |config|
>>>>>>>>   config.nested.add_link('Подпрограммы', [:subprograms])
>>>>>>>> end
>>>>>>>>
>>>>>>>> It shows parents and subprograms well in list when I add [:parent,
>>>>>>>>
>>>>>>>> :subprograms] to config.list.columns, but by following nested link it
>>>>>>>>
>>>>>>>> shows me the same record (not subprograms set) (containing that link)
>>>>>>>> So it looks like self-referrental nesting.
>>>>>>>>
>>>>>>>> What am I doing wrong.
>>>>>>>
>>>>>>> I can't see why is not working. Do you get same url for both links? Do 
>>>>>>> you get
>>>>>>> some warnings or errors in log file?
>>>>>>>
>>>>>>> --
>>>>>>> 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