Ruby on Rails Friday, May 30, 2014

I resolved that problem.

I done somethig like so to update each column:

def update_multiple
@postis = Posti.find(params[:posti_ids])

@postis.each do |posti|
posti.update_column(:stato, params[:posti])
end
redirect_to prenotazione_path(params[:spectacle_id])
end

<%= form_for :posti, :url => update_multiple_path, :html => { :method =>
:put } do |f| %>
<%= hidden_field_tag "spectacle_id", params[:spectacle_id] %>
<strong>Posti scelti:</strong>
<ul>
<% for posti in @postis %>
<li>
<%=h posti.numero %>

<%= hidden_field_tag "posti_ids[]", posti.id %>
</li>
<% end %>
</ul>

<p>

<%= f.hidden_field :stato, :value => "checked" %>
</p>
<p><%= f.submit "PRENOTA" %></p>
<% end %>

It works very well and i am so very happy. Thank you Colin for helps. I
will very well a tutorial when i will finish all my esams at university.
Ruby on Rails is the best :)

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8a2d2dc3910329058daf40d9b8537df9%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment