Hi Jack
try adding this method to the controller
def conditions_for_collection
"parent_id is null " unless params[:parent_model]
end
it should do the trick
Quote:
Hello,
newbie here...I have acts_as_tree working with active scaffold. My problem is that it lists parents and children in the scaffold. For instance the database has:
-
id | name | parent_id |
-
1 |Animal | null |
-
2 |Cat | 1 |
-
3 |Dog | 1 |
-
4 |Siamese | 2 |
-
5 |Collie | 3 |
when it displays in active scaffold it lists it like:
-
---------
-
|Animal |
-
|cat |
-
|Dog |
-
|Siamese |
-
|collie |
-
---------
What I want to do is see only where parent_id is nil but when i click the link 'Show Child' I want to bring up the children below the parent. such as:
-
------------------
-
|Animal |
-
| |cat | |
-
| |Dog | |
-
------------------
I got the link for the child to work with:
-
#in controller
-
active_scaffold :category do |config|
-
config.columns =[ :name ]
-
config.nested.add_link("'Show Child'", [:children])
-
end
But i need help to only display the parent at the start.
Thanks
|