Maay A.
2010-Oct-15 10:54 UTC
[Rails] “ undefined method `enumerable_enumerator_path' " error.
I''m using basic scaffold structure. What I need, is to add ''moderate'' action and view by changing published to true. In my idea, on moderate.html I should get the list of all unpublished entries with the ability to change and save their parameters. Here are parts of my code: #names_controller.rb def moderate @name = Name.find(:all, :conditions => {:published => false} ) respond_to do |format| format.html format.xml end end #moderate.html.erb <% form_for @name.each do |f| %> <%= f.error_messages %> <%= f.text_field :which %> <%= f.text_field :what %> <%= f.check_box :published %> <%= f.submit %> </p> <% end %> Instead I''m getting this error: NoMethodError in Names#moderate Showing app/views/names/moderate.html.erb where line #1 raised: undefined method `enumerable_enumerator_path'' for #<ActionView::Base:0x1042c3e90> Extracted source (around line #1) So, can you help to newbie please? ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] Rails 2.3.5 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
maay
2010-Oct-15 11:33 UTC
[Rails] Re: “ undefined method `enumerable_enumerator_path' " error.
I''m steel looking for an answer or suggestion. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Oct-15 12:23 UTC
[Rails] Re: “ undefined method `enumerable_enumerator_path' " error.
On Oct 15, 11:54 am, "Maay A." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I''m using basic scaffold structure. What I need, is to add ''moderate'' > action and view by changing published to true. In my idea, on > moderate.html I should get the list of all unpublished entries with the > ability to change and save their parameters. Here are parts of my code: > > #names_controller.rb > def moderate > @name = Name.find(:all, :conditions => {:published => false} ) > respond_to do |format| > format.html > format.xml > end > end > > #moderate.html.erb > <% form_for @name.each do |f| %>You don''t want that each there - that''s asking form_for to display a form for the enumerator object this returns which is not what you want. Assuming you want a form for each of the objects in that array you want something more like <% @name.each do |name| %> #do something with name here <% end %> or render a partial for each name object. Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.