Rails, making certain multiparameter attributes optional?

Posted by Joseph Silvashy on Stack Overflow See other posts from Stack Overflow or by Joseph Silvashy
Published on 2011-01-01T22:47:10Z Indexed on 2011/01/01 22:54 UTC
Read the original article Hit count: 275

Filed under:

Is there a method already part of Rails for making certain parameters option when part of a multiparameter attribute, for example say I'm prompting a user for their birthday, when saved the has may look like this:

"birthday(2i)"=>"8",
"birthday(3i)"=>"17",
"birthday(1i)"=>"1980"}, ...

But the issue arises when say I want to allow the user to just provide their month and day, making the year optional, how would this work being a datetime object, I'm assuming you can't do this as a date object... but any ideas would be helpful.

Happy new year.

© Stack Overflow or respective owner

Related posts about ruby-on-rails