Resetting a partial using RJS, and passing an instance variable?
Posted
by Elliot
on Stack Overflow
See other posts from Stack Overflow
or by Elliot
Published on 2010-06-06T14:18:07Z
Indexed on
2010/06/06
14:22 UTC
Read the original article
Hit count: 325
ruby-on-rails
|AJAX
Hey guys here is my code (roughly):
books.html.erb
<% @books.each do |book| %>
<% @bookid = book.id %>
<div id="enter_stuff">
<%= render "input", :bookid => @bookid %>
</div>
<%end%>
_input.html.erb
<% @book = Book.find_by_id(@bookid) %>
<strong>your book is: <%=h @book.name %></strong>
create.rjs
page.replace_html :enter_stuff, :partial => 'input2', :object => @bookid
Only create.js doesn't seem to work though, if instead of passing the partial I passed "..." it does work, so I know its that there are instance variables in the partial that aren't being reset. Any ideas?
© Stack Overflow or respective owner