Ruby on Rails Wednesday, April 29, 2015

On 29 April 2015 at 16:58, Gm <javaplayer@gmail.com> wrote:
> Hi Chris.
> It's just a simple validation method:
>
> validate :custom
>
> def custom
> if self.text.blank? and self.persisted?
> return errors.add(:base, 'Error')
> else
> end

You are missing an end statement so whatever follows after this will
be executed as part of the validation. Presumably you have an extra
end later on which allows it to run.

Colin

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvUgCf73jw6_3GvGmBtCwLuUa0Mer%3DBeAho5hALGz6bWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment