Validate without create

Hey all,

I have created an article model that works fine. When a user creates
an article and submits the form, I need him/her to be sent to a
preview page to make sure they proofread it. However, I want to use
the model-level validation to validate the input before going to the
preview page. Currently, since the article is only created after the
previewing, there is no validation before the preview. Of course, I
could roll-my-own, but ruby’s is so much easier.

Any ideas.

Thanks in advance.

-josh

On 10/11/06, Josh S. [email protected] wrote:

could roll-my-own, but ruby’s is so much easier.

Any ideas.

Thanks in advance.

-josh

For this you just need to call valid? on your model. That will run
through
all validations and populate the errors for you.

eg

@articles.valid?

This will not even approach the db (except perhaps in the case of
validates_uniqueness_of)

You rock!

Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs