On Oct 15, 11:54 am, "Maay A." <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to