I have form, and date_select there
here is my form (in edit view)
=form_for @user do |f|
%p
= f.date_select('user','birthday',:start_year => 1940)
here is my edit action
def edit
@user = User.find(params[:id])
end
in my case it writes an error
undefined method `merge' for "birthday":String
i have attribute birthday:date, also i tryed on string attribute but it didnt work. So how to use date select in my case?(also how to validate it? and how to set default values?)
Thanks in advance
You don't need to add the argument for the user, it is already contained in the f
variable.
=form_for @user do |f|
%p
= f.date_select(:birthday,:start_year => 1940)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.