I am new to RoR and trying to update an existing app developed by someone else. I have the following form in a partial file to display for the new and edit actions. I added :value to the program_date field to display only the date of the timestamp field, removing the time portion of the field value. It works as needed for edit...
= form.inputs do
= form.input :program, :as => :select, :collection => @programs
= form.input :headline, :as => :string
= form.input :message, :as => :text
= form.input :program_date, :as => :string, :input_html => { :class => 'date-pick', :value => @program_special.program_date.strftime("%m/%d/%Y")}
But when creating a new record, I get an error when trying the same form for a creating a new record, I guess because the field has no value when new...
How can I apply to only the edit form? Or am I trying to accomplish this in the correct way?undefined method `strftime' for nil:NilClass
Thanks, Robert
Robert
-- Robert
No comments:
Post a Comment