Forum: Ruby on Rails ActiveRecord Validation not working

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
54f61f7e636fbb8e9a53ce43c02d61b2?d=identicon&s=25 Ron Bromwell (ronb722)
on 2007-07-30 22:52
I am have trouble trying to figure out how validation is suppose to
work. here is what I have:

 validates_length_of :emailOptionTwo, :within => 1..11

When I submit my form with a value the is outside the with, I do not get
an error. The render action int the control is being executed.
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2007-07-31 00:09
(Received via mailing list)
you should get the error when you try to save, something like so:

def create
  @model =[:my_model])
    flash[:notice] = 'Success'
    redirect_to :some_action
    flash[:error] = 'Error'
    render :action => :new

then typically in your view you'd show the errors:
<%= error_messages_for :my_model %>

On Jul 30, 4:52 pm, Ron Bromwell <>
This topic is locked and can not be replied to.