Results 1 to 7 of 7
Thread: Rails: Layouts & Search/Sort
Jul 6, 2006, 13:23 #1
- Join Date
- Mar 2004
- Toronto, Canada
- 0 Post(s)
- 0 Thread(s)
Rails: Layouts & Search/Sort
Three questions for you all...
def index list render :action => 'list' end
2. I have an admin section to a site I'm building. Here's the pertinent
bit of the layout that all controllers are using:
<div id="main-content"> <%= @content_for_layout %> </div> <div id="sidebar"> </div>
as new, edit, list etc. My problem is that for each controller I want a
specific chunk of content to show up in the sidebar. How can I
accomplish this without altering the layout to look something like this:
<div id="main-content"> <%= @content_for_layout %> </div> <div id="sidebar"> <% if @controller.controller_name == 'news' %><%= render(:partial => "news_sidebar") %><% end %> <% if @controller.controller_name == 'users' %><%= render(:partial => "users_sidebar") %><% end %> <% if @controller.controller_name == 'links' %><%= render(:partial => "links_sidebar") %><% end %> </div>
that takes the controller name as an argument? Other suggestions?
3. I'm used to building searches and sorting mechanisms with PHP that
analyze a $_GET request and display data based on those parametrs. URLs
end up looking like:
someone provide some code for me to look at that does just this? I'm
very much a learn by seeing kind of guy and would greatly appreciate it.