我试图使用内置的 ruby 帮助器进行日期时间选择,尽管它似乎没有将值传递给 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])
控制台输出
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