0

im trying to use the builtin ruby helper for datetime select, though it doesnt seem to be passing the values through to ActiveRecord

form.haml.html

.row
      .two.columns
        = f.label :date_and_time, :class =>'left inline'
      .ten.columns
        = f.datetime_select('datetime', :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'}, :order => [:day, :month, :year])

console output

Processing by EventsController#update as JS
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"sebpDgAPPmK8q9024vrhN4eEQT7vZLr+pa5XdSicAMc=", "event"=>{"event"=>"1", "location_id"=>"13", "datetime(3i)"=>"5", "datetime(2i)"=>"5", "datetime(1i)"=>"2012", "datetime(4i)"=>"01", "datetime(5i)"=>"03", "duration"=>"34", "arrival_time"=>"34", "team_id"=>"1", "opponent_id"=>"4", "home_or_away"=>"Away"}, "commit"=>"Update Event", "id"=>"68"}
  User Load (1.5ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 38 LIMIT 1
  Event Load (0.8ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1  [["id", "68"]]
  CACHE (0.0ms)  SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1  [["id", "68"]]
  User Load (1.4ms)  SELECT "users".* FROM "users" WHERE "users"."team_id" = 1
   (0.4ms)  BEGIN
   (0.9ms)  UPDATE "events" SET "updated_at" = '2013-02-09 11:44:24.830499', "selected_players" = '---
- ''''
' WHERE "events"."id" = 68
   (8.2ms)  COMMIT

2 Answers 2

1

According to your label it's :date_and_time field in your database, right? If so you should use it in your datetime_select:

= f.datetime_select :date_and_time, :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'}, :order => [:day, :month, :year])
Sign up to request clarification or add additional context in comments.

2 Comments

na the label is different to the actual field in the database
from what i can see on console the form is passing the hash but activerecord doesnt seem to be seeing it
0

found the issue was within the controller, still referring to old naming we had in place, since making the change all appears to be working

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.