Resetting a partial using RJS, and passing an instance variable?
- by Elliot
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?