开发者

ruby on rails 3 date attribute with date_select not being assigned

I have a view with the following:

=f.date_select :start_date, { :start_year => 1990, :end_year => Time.now.year, :discard_day => true, :prompt => true, :order => [ :month, :year] }

Where my :start_year is an attribute on my ActiveRecord model called WorkHistory. And in my controller I have:

@work_history = WorkHistory.new(params[:work_history])

The start_date never gets set and is always nil. Am I missi开发者_如何学Gong something?


Ok I needed to add attr_accessible for it to work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜