Hi,
I''m trying to implement a very simple acts_as_tree search in my index
html.
I am able to show the parents, with no issue, but the children will
not show.
I have something like this for the parent, which displays fine:
<% for group in Group.roots %>
<td>
<tr>
<a href="#" onclick="Effect.BlindDown(''show_<%=
group.id%>'');return
false;">+</a>
<!-- calls the show method, but utilizes the acts_as_tree -->
<%= link_to (group.name), group %> <br>
<div id ="show_<%= group.id%>"
style="display:none;">
For the children, however, using the following will not work because
it is looking to the index method.
<% for group in Group.children %>
<%= link_to (group.name), groups %>
Any pointers? Should I be using object.children to get the children?
thanks
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi,
I think you''ve made a little mistake...
The correct form is this:
<% for group in Group.roots %>
...
<%= link_to (group.name), group %>
...
<% for child in group.children %>
...
<%= link_to (child.name), child %>
...
Notice the use of "group.children" instead "Group.children"
Hope this helps...> Hi,
>
> I''m trying to implement a very simple acts_as_tree search in my
index
> html.
>
> I am able to show the parents, with no issue, but the children will
> not show.
>
> I have something like this for the parent, which displays fine:
>
> <% for group in Group.roots %>
> <td>
> <tr>
> <a href="#"
onclick="Effect.BlindDown(''show_<%=
group.id%>'');return
> false;">+</a>
> <!-- calls the show method, but utilizes the acts_as_tree -->
> <%= link_to (group.name), group %> <br>
> <div id ="show_<%= group.id%>"
style="display:none;">
>
> For the children, however, using the following will not work because
> it is looking to the index method.
>
> <% for group in Group.children %>
> <%= link_to (group.name), groups %>
>
> Any pointers? Should I be using object.children to get the children?
> thanks
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Yes, this was helpful, and I appreciate it. Thanks for your reply. On Feb 8, 11:29 pm, Gianluca Tessarolo <tessarolo.gianl...-6ZZdBs7hMehZp5Udy/Obhg@public.gmane.org> wrote:> Hi, > > I think you''ve made a little mistake... > > The correct form is this: > > <% for group in Group.roots %> > ... > <%= link_to (group.name), group %> > ... > <% for child in group.children %> > ... > <%= link_to (child.name), child %> > ... > > Notice the use of "group.children" instead "Group.children" > > Hope this helps... > > > Hi, > > > I''m trying to implement a very simple acts_as_tree search in my index > > html. > > > I am able to show the parents, with no issue, but the children will > > not show. > > > I have something like this for the parent, which displays fine: > > > <% for group in Group.roots %> > > <td> > > <tr> > > <a href="#" onclick="Effect.BlindDown(''show_<%= group.id%>'');return > > false;">+</a> > > <!-- calls the show method, but utilizes the acts_as_tree --> > > <%= link_to (group.name), group %> <br> > > <div id ="show_<%= group.id%>" style="display:none;"> > > > For the children, however, using the following will not work because > > it is looking to the index method. > > > <% for group in Group.children %> > > <%= link_to (group.name), groups %> > > > Any pointers? Should I be using object.children to get the children? > > thanks-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
db_333 wrote:> Yes, this was helpful, and I appreciate it. Thanks for your reply. > > > On Feb 8, 11:29�pm, Gianluca TessaroloYou probably don''t want acts_as_tree in any case. Awesome_nested_set is much more efficient. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.