Re: [Rails] required field for one, optional for another
On Sat, Apr 27, 2013 at 6:40 AM, Soichi Ishida <lists@ruby-forum.com> wrote:
> Is there any Ruby way to set the requirement depending on the type of
> users?
If I recall correctly, some of the standard validation helpers will
take an "if" parameter, such that if the parameter evaluates to false,
the validation is not applied. If worst comes to worst, you can
validate with a method you write yourself, that looks at that flag and
Does The Right Thing depending on whether it's set.
-Dave
--
Dave Aronson, the T. Rex of Codosaurus LLC,
secret-cleared freelance software developer
available for contracts or temp employment.
See information at http://www.Codosaur.us/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home