RoR: Replace_html with partial and collection not functioning

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-03-30T23:24:11Z Indexed on 2010/03/31 5:53 UTC
Read the original article Hit count: 321

Filed under:
|

I am trying to create a tabbed interface using the prototype helper method "replace_html." I have three different partials I am working with. The first one is the 'main tab' and it is loaded automatically like so:

<div id = "grid">
    <% things_today = things.find_things_today %>
    <%= render :partial => "/todaything", :collection => things_today, :as =>:thing %>
</div>

...which works fine. Similarly, I have a _tomorrowthing partial which would replace the content in the 'grid' div like so:

<%things_tomorrow = things.find_things_tomorrow%>
<%= link_to_function('Tomorrow',nil, :id=>'tab') do |page|
  page.replace_html 'grid' , :partial => '/tomorrowthing',:collection => things_tomorrow, :as => :thing
end %>

If I click on this tab nothing happens at all. Using firebug, the only errors I find are a missing ) after argument list which is contained in the Element.update block where the link_to_function is called. What am I doing wrong?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about prototype