Hey Everyone,
so I've watched http://railscasts.com/episodes/43-ajax-with-rjs
but I have a question:
In my view I have the following:
<div id="testly">
<%= render :partial => "test" %>
</div>
This works.
Using create.rjs to change the content in this div, I have the following in my create.rjs file:
page.replace_html :testly, :partial => 'test'
Simply put, this should just refresh the partial right? But its not working... Would love any suggestions!
Also in regards to checking errors - I haven't been able to yet (as its on a different computer), but if I replace the :partial => "test" in create.rjs with "..." it replaces it just fine - making me believe it isn't an issue with the ajax?
I've done some more testing, the partial declaration works - what doesn't seem to work is calling the code in the partial through javascript.
The code in the partial is:
<% today=Time.now.strftime("%m/%d/%Y") %>
<% @books.each do |book| %>
<% if book.created_at.strftime("%m/%d/%Y")==today %>
<div class="item-book" style="clear:both;">
<%=h book.author.name %>
</div>
<div class="item-delete">
<%= link_to '<div class="delete"></div>', book, :confirm => 'Are you sure?', :method => :delete %>
</div>
<div class="item-date">
<%=h book.created_at.strftime("%m/%d/%Y") %>
</div>
<% end %>
<% end %>