Skip to content

Instantly share code, notes, and snippets.

@karmi
Created November 26, 2008 19:23
Show Gist options
  • Select an option

  • Save karmi/29512 to your computer and use it in GitHub Desktop.

Select an option

Save karmi/29512 to your computer and use it in GitHub Desktop.
<tr>
<td style="width: 25%" class="align-right sortable"><%= text_field_tag 'program_event[entrance_fees][][price]', nil, :class => 's' %> Kč</td>
<td style="width: 50%" class="sortable">
<!-- <span class="drag_handle">&nbsp;&nbsp;&nbsp;&nbsp;</span> -->
<%= text_field_tag 'program_event[entrance_fees][][description]', nil %>
</td>
<td>&nbsp;</td>
</tr>
class ProgramEvent < ActiveRecord::Base
has_many :entrance_fees
# Complex forms quite complicated, huh?
def entrance_fees=(options)
options.each do |new_entrance_fee|
if entrance_fee = ProgramEntranceFee.create( new_entrance_fee )
self.entrance_fees << entrance_fee
end if new_entrance_fee[:price] && !new_entrance_fee[:price].blank?
end
end
end
Processing Admin::ProgramEventsController#update (for 127.0.0.1 at 2008-11-26 20:18:24) [PUT]
Parameters: {"program_event"=>{"entrance_fees"=>[{"price"=>"7000", "description"=>"Seven thousand"}, {"price"=>"8000", "description"=>"Eight thousand"}], ...}, }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment