I believe you are not thinking in the proper use of validations.

What you want to do is:

s = Step.new
...

s.valid?
s.errors.on(*attribute_to_be_validated*)  #returns nil for a valid value. or
the error message in case the validation was not met



On Fri, Mar 26, 2010 at 2:36 AM, Hugo Mag <[email protected]> wrote:

> Hi all,
>
> I need to call validation methods from outside the models.
> This is a workflow application so the models don't have validation
> methods declared in it.
>
> Example:
> class Step < ActiveRecord::Base
> end
>
> def Wrk < ActiveRecord::Base
>  has_many :steps
> end
>
> I've tried using for instance Step.validates_numericality_of(...) or
> Wrk.validates_format_of(...) but it does not work.
>
> Can anyone help me?
> Best regards,
> Hugo
> --
> 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 post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Mahmoud Said
Software Engineer - eSpace
blog.modsaid.com

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to