Problem with displaying content when using RJS

Posted by Shreyas Satish on Stack Overflow See other posts from Stack Overflow or by Shreyas Satish
Published on 2011-01-11T11:50:01Z Indexed on 2011/01/11 11:53 UTC
Read the original article Hit count: 297

Filed under:
|
|

I'm quite sure this is a silly error but I'm unable to spot it. Please help me out on this.

This is my controller code

def filter_by_content
  @articles = Article.find(:all)
end

My RJS (filter_by_content.rjs)

update_page do |page|
  page.replace_html 'articles', :partial => 'main/filtered', :object => @articles
end

My Partial 'filtered'

<div id = "articles">
  <% if @articles %>
    <% @articles.each do |article| %>
      <%= article.title %>
    <% end %>
  <% end %>
</div>

I checked my server, and the articles are sure getting fetched but the problem is with displaying them. Thanks !

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about AJAX