Tim Shaffer wrote in post #994906: > On Monday, April 25, 2011 12:00:43 PM UTC-4, Ruby-Forum.com User wrote: >> >> I find this odd because I haven't even inputted any variables in the >> view yet the date is invalid? >> > > Actually that's probably exactly why you have an invalid date. If you > haven't input any variables yet, params hash will be empty. This means > the > code you posted basically evaluates to the following: > > Date.new(nil.to_i, nil.to_i, nil.to_i) > > Which returns your ArgumentError. > > Can you wrap the Date.new call in an *if *statement so it only gets > executed > once the form has been submitted?
Thanks for the reply, makes sense. How would I write an if statement like that for a form_tag form? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

