Comment requested on first Rails code


I recently started playing with RoR, and I am not sure if I got my setup right. Could someone comment on the code below?

Background: I want to expand/collapse a list of items. The expanded list represents a recursive hierarchical tree, while the collapsed one shows the first tree level below the current position.

  1. My controller has:

    def index

     # This action defines the content of a complete page, irrelevant code has been omitted)


    def expand

     # irrelevant code omitted
     render :partial => 'children_recursive'


    def collapse

     # irrelevant code omitted
     render :partial => 'children'


The relevant part of the index view looks like this:

<%= render :partial => ‘children’ %>

The children and children_recursive partial views contain two lines each:

<%= link_to_remote(“Expand”, :update => ‘children’, :url => { :action => “expand”, :id => })%>

<%= display_children %>