0
使用this gem來設置我的應用中的日曆。除了更改月份的箭頭一切正常..收到以下錯誤:Rails無效日期錯誤
ArgumentError in UsersController#show
invalid date
Rails.root: /Users/nelsonkeating/Desktop/ReminDeal
Application Trace | Framework Trace | Full Trace
app/controllers/users_controller.rb:13:in `show'
Request
Parameters:
{"month"=>"2012-06",
"id"=>"7"}
users_controller.rb
def show
@user = User.find(params[:id])
@friends = @user.friends.paginate(page: params[:page])
@date = params[:month] ? Date.parse(params[:month]) : Date.today
end
控制檯:
Started GET "https://stackoverflow.com/users/7?month=2012-06" for 127.0.0.1 at 2012-05-29 21:30:04 -0700
Processing by UsersController#show as HTML
Parameters: {"month"=>"2012-06", "id"=>"7"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 7 LIMIT 1
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "7"]]
Completed 500 Internal Server Error in 33ms
ArgumentError (invalid date):
app/controllers/users_controller.rb:13:in `show'
完美,謝謝! – js111