Re: Re: validation help please

Jodi Showers
Fri, 01 Mar 2013 16:37:55 -0000

Dave,  you have to add an instance method "standard_question?" to your
model

def standard_question?
end

from the url below you can see that you can pass a :message param to
customize the error message

http://guides.rubyonrails.org/active_record_validations_callbacks.html#message


On Fri, Mar 1, 2013 at 11:13 AM, Dave Castellano
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:

> Thanks again,
>
> Is there a way to add a message if validation fails using lambda method
> (I am using Lambda method until I can figure out why
> validates :question,        :presence   => true, :if
> =>:standard_question?
> generates
> undefined method `standard_question?'' for
#<Question:0x007f947ddb2e00>)
>
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/groups/opt_out.