Jump to content

The ultimate community for Ruby on Rails developers.


Photo

one form create multiple records of one model


  • Please log in to reply
No replies to this topic

#1 Timmofie

Timmofie

    Passenger

  • Members
  • 1 posts

Posted 04 June 2014 - 12:37 PM

Dear all, 

 

 

I've started a rails 4 app to schedule and calculate the work hours of my employees.

 

So far I created a employee model and a time_unit model to display all work hours.

 

The only problem is that I don't know how to create multiple objects at once.

 

 

Currently my form looks like this

= form_tag('/time_units') do

%p= label_tag :start
= datetime_select("time_unit", :start, minute_step: 15)

%p= label_tag :end
= datetime_select("time_unit", :end, minute_step: 15)

%p= label_tag :personalassistance_id
= collection_select("time_unit",:personalassistance_id, Personalassistance.all, :id, :name)

%p= submit_tag

I tried to use arrays just like the solution here, but I cannot get it to work.

 

 

I would be very thankful for your help.

 

Cheerios, Timmofie






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users