Forms with and without Models and Error Handling

Hi,

I currently programming a delicious clone to understand ruby on rails.
The problem I’ve got is that I prefill a form (form without models)
without a database connection and then save it into the database.

For validation i am using the validation helper methods. My Problem is
that i don’t know how I get the error hash from the helper method
validates… etc. because I don’t have a fully database connection (but
if the controller tries to save, the helper methods will evoke an
errors.add - right?). When I update the records (form with database),
everything is find (cause I have a real database connection). So my
question is, how i can read out the errors in my controller or view?

error_messages_for… in the view will evoke an error that the object is
nil.

Or do I have to programm my own validation actions as protected?

Greets -Jens (sorry for my bad english)

Hi,

I am not sure if I follow exactly what you are saying. However I think
what you are asking for Validations for non-ActiveRecord Model
Objects. You may want to read

http://www.realityforge.org/articles/2005/12/02/validations-for-non-activerecord-model-objects

that describes a method for forms thazt are not backed by database
objects.

On 3/2/06, Jens K. [email protected] wrote:

question is, how i can read out the errors in my controller or view?

error_messages_for… in the view will evoke an error that the object is
nil.

Or do I have to programm my own validation actions as protected?

Cheers,

Peter D.