In Rails 2, I used this code to get a specific part of the page to update.
<div id="sidebar_div" class="span-3">
<ul class="sidebar_list">
<% for page in @section.pages %>
<li><%= link_to_remote "#{page.name}", :update=>'show_page', :url => { :controller=>'pages',:action=>'show_page', :id=>page.id }, :html=>{} %></li>
<hr/>
<% end %>
</ul>
</div>
<div id='show_page' class='span-18 last vert_divider'>
<%= render :partial => 'pages/show', :locals => { :page=>@page } %>
</div>
On the controller pages, I had a show_page method that again displayed a partial one.
In Rails 3, I DO NOT KNOW HOW TO CREATE THIS. I want to use jQuery, which I already know how to code, but I don't know how to make it work this way. Should I create a js.erb file in my opinion? I watched http://railscasts.com/episodes/205-unobtrusive-javascript , but I still don't know how to make it work to refresh one part of the page! Basically, I have this sidebar with links to it, and every time the user clicks on one of them, the central part of the page should refresh - AJAX! How should I do it? Do I still need this show_page method in the controller?
source
share