Forum: Ruby on Rails Forms with and without Models and Error Handling

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
835bca5f2e07ab12c90ad0acc5999ff7?d=identicon&s=25 Jens Krahe (krahe)
on 2006-03-02 11:27
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)
67b6389be42524fbd776e44fd35c3d7e?d=identicon&s=25 Peter Donald (Guest)
on 2006-03-02 11:34
(Received via mailing list)
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/va...

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


On 3/2/06, Jens Krahe <jens.krahe@gmail.com> 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 Donald
This topic is locked and can not be replied to.