Insert multiple entires

need some help with this…

form:
<%= simple_form_for(@week) do |f| %>

<% @kws.each do |w,y| %>

<%= w %>.<%= “#{y}”[2…4] %> #gives a val something like:
482012
<%= text_field_tag “workhour[]” %>
<%= hidden_field_tag “week_ids[]”, “[#{w}#{y}]” %>
<% end %>
<%= hidden_field_tag(:project_id, “#{@project_data.id}”) %>

Controller:
def create
params[:week_ids].each do |week_id|
Week.create(
:project_id => params[:project_id],
:workhour => params[:workhour],
:week_year => week_id
)

Log:
“workhour”=>[“66”, “”,…
“week_ids”=>["[432012]", “[442012]”,…
“project_id”=>“2”

project_id is in… but how to fetch workhour and week_id?

Thanks for some idea’s

On 23 October 2012 09:47, Werner [email protected]
wrote:

  <% end %>

Log:
“workhour”=>[“66”, “”,…
“week_ids”=>["[432012]", “[442012]”,…
“project_id”=>“2”

project_id is in… but how to fetch workhour and week_id?

I don’t understand the question. You have shown us the code to fetch
workhour and week_id from params. What is it that you do not know how
to do.

Colin

Am 24.10.2012 um 11:27 schrieb Colin L. [email protected]:

Hi Colin… thanks…

this is solved so far…

  <%= hidden_field_tag "week_ids[]", "[#{w}#{y}]" %>
   )

to do.

Colin


You received this message because you are subscribed to the Google G. “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 https://groups.google.com/groups/opt_out.

Werner L.
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs