I am trying to display subpages from the subpages parent on a subpage.
The code between the lines doesn't work for me. Does anyone has an
idea what would be a better code?
pages and subpages are in the same controller.

@page = Page.find_by_name(params[:name])

        if @page.respond_to?('subpages')
          @subpages = @page.subpages
---------------------------------------------------------------------------
        elsif @page.parent.respond_to?('subpages')
          @subpages = @page.parent.subpages
        end
---------------------------------------------------------------------------
 end


***application.html.erb***

for page in @page
 show link to each page...
end

for page in @subpages
show link to each subpage..
end



-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to