Search code examples
javascriptruby-on-railsrubyactioncontroller

undefined method `collect' for #<Page:0x007f4f200a9350


can anyone help me with this error ? I'm pretty rookie and still not how it works so if anyone can explain to me how to fix this is really appreciate it , now I attached the code which gives me the error

3: <%= render :partial => "shared/ubiquo/feedback" %>
4: 
5: <%= show_filter_info %>
6: <%= pages_list(@pages, @pages_pages) %>
7: 
8: <% content_for :sidebar do %>
9: <%= show_filters %>

Solution

  • I am sure you have something like this written somewhere:

    @pages = Page.collect #...
    

    whereas it ought (in order to use Enumerable methods) be:

    Page.all.collect
    

    because Enumerable's collect operates on array data structure, and Page.all is what actually returns this collection.