Started POST "/risks" for 127.0.0.1 at 2014-06-29 12:58:02 +0100
Processing by RisksController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."remember_token" = '
(0.2ms) BEGIN
SQL (0.3ms) INSERT INTO "risks" ("action", "area", "created_at", "date_of_action", "description", "owner", "title", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["action", "dadad"], ["area", "IT"], ["created_at", "2014-06-29 11:58:02.816205"], ["date_of_action", "2014-06-29"], ["description", "aadad"], ["owner", "5"], ["title", "aa"], ["updated_at", "2014-06-29 11:58:02.816205"], ["user_id", 2]]
(0.3ms) COMMIT
Redirected to http://localhost:3000/
Completed 302 Found in 9ms (ActiveRecord: 1.2ms)
You can still see that the impact and likelihood fields are still omitted during the commit. Maybe this is because they are being passed in as strings (denoted by the quotes around the values you can see being passed in the terminal output above), even though the array is explicitly integer? I have tried forcing integers like this, but it has made no difference:
<span class="impact-input">
<%= f.input :impact, as: :integer, required: false, :error => false, input_html: { class: 'form-control', :name => "impact[]" } %>
</span>
<span class="likelihood-input">
<%= f.input :likelihood, as: :integer, required: false, :error => false, input_html: { class: 'form-control', :name => "likelihood[]" } %>
</span>
So I'm still stuck! If I change the input name like I have, would I have to adjust anything else in my application? This is my first rails project so forgive me if the answer to that is an obvious 'of course'.
Thank you both for your help thus far.
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/b22d6d2d-4362-41b9-90f7-6e33faf17804%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment