here…is the essential
def edit
@booking = Booking.new
@project = Project.find(params[:id])
@partprojects = Project.find_all_by_parent_id(@project.id)
@bookings = Booking.zwischen(start, ende)
@main_hours = main_hours_sum(@project.id)
@part_hours = part_hours_sum(@partprojects.id)
@all_hours = @main_hours + @part_hours
end
form
<%= simple_form_for @booking, :url => booking_path, :remote => true,
:method => :put do %>
<% @bookings.each do |booking|%>
<%= fields_for "booking[]", booking do |f|%>
<%= f.text_field :hour, :class => 'submittable' %>
<%= hidden_field_tag "booking_ids[]", booking.id %>
<% end %>
<% end %>
coffee
$(“.submittable”).live “change”, →
$(this).parents(“form:first”).submit()
def update
if params[:booking_ids]
params[:booking_ids].each do
Booking.update(params[:booking].keys,
params[:booking].values).reject { |p| p.errors.empty? }
end
end
respond_to do |format|
format.js{
@project = Project.find(params[:id])
@main_hours = main_hours_sum(@project.id)
}
end
end
Am 20.11.2012 um 13:22 schrieb Jim Ruther N. [email protected]:
params[:booking_ids].each do
end
@project = Project.find(params[:id])
<%end%>
if params[:booking_ids]
But it is unclear to me how to update the
On Mon, Nov 19, 2012 at 10:25 PM, Werner [email protected] wrote:
using remote: true, you can create an update.js.erb or update.js.haml which will
be rendered
To unsubscribe from this group, send email to
[email protected].
visit my blog at http://jimlabs.heroku.com
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/aGQY2mvKhoUJ.
Werner L.
[email protected]