class GreenRoomController < ApplicationController active_scaffold :green_room do |config| "other configs" config.columns[:parent].ui_type = :select config.nested.add_link("Next Level", [:children]) end def conditions_for_collection return ['parent_id is NULL'] if !params.has_key?(:nested) end end
this works in as expected in development but does not work in production. In production, when I click the nested link I get a nested list that has one record and that record is the record I have just clicked.
Found exactly where my problem is, and I don't know if there is a fix for it . . .
"long Query " childrens_green_rooms.parent_id = green_rooms.id WHERE (green_rooms.id = '3') AND green_rooms.id IN ('3') This is in production, and in the development it is
"long query" parents_green_rooms.id = green_rooms.parent_id WHERE (green_rooms.parent_id = '4') LIMIT 0, 15 [0m I dont know why there is this difference, and how to fix the issue of different queries being issued. BTW is this active scaffold creating the query or Rails?
Found a solution to this problem, for whatever reason it seems that active scaffold could determine the reverse association fine on the development machine and on the production it could not. By putting in config.columns[:children].association.reverse = :parent in my active scaffold config in the controller I wa sable to get the relationship working.
Do you use acts_as_nested_set plugin or BetterNestedSet? I ve tried it with BetterNestedSet and the UI seems to work perfect, but unfortunetly 'lft' and 'rgt' attributes are not set correctly.
Could you please take a look if they are set correctly in your app?
Thanks a lot in advance.
root node has lft = 1 and rgt = 2, which is obviously incorrect. right has to be 2 * node_num for the root node. At least as far I know.
-- volker
On Nov 8, 2:20 pm, White Wizzard <The.White.Wizz...@gmail.com> wrote:
> Found a solution to this problem, for whatever reason it seems that > active scaffold could determine the reverse association fine on the > development machine and on the production it could not. By putting > in config.columns[:children].association.reverse = :parent in my > active scaffold config in the controller I wa sable to get the > relationship working.
I used what was built into rails, in my green room model I have acts_as_nested set. I was not using better nested plugin. Also I did not use lft and rgt in my database, I omitted them ( due to ignorance). Anyways it worked for me in production.
> Do you use acts_as_nested_set plugin or BetterNestedSet? > I ve tried it with BetterNestedSet and the UI seems to work perfect, > but unfortunetly 'lft' and 'rgt' attributes are not set correctly.
> Could you please take a look if they are set correctly in your app?
> Thanks a lot in advance.
> root node has lft = 1 and rgt = 2, which is obviously incorrect. right > has to be 2 * node_num for the root node. > At least as far I know.
> -- > volker
> On Nov 8, 2:20 pm, White Wizzard <The.White.Wizz...@gmail.com> wrote:
> > Found a solution to this problem, for whatever reason it seems that > > active scaffold could determine the reverse association fine on the > > development machine and on the production it could not. By putting > > in config.columns[:children].association.reverse = :parent in my > > active scaffold config in the controller I wa sable to get the > > relationship working.