Form responders

Julian ''Julik'' Tarkhanov
2005-10-05T01:48:51Z

Odd question but I think it slips through without me noticing a
viable response.

How can I set up some meaningful ActiveRecord stub so that I can make
a "form responder" - or even better, make my controller be this
responder. What I would love to have is form values persisting
through reloads without loading them manually into the view.
Helpers nicely address this, but there the params are stored inside a
model objects. Form helpers, as I take it, (by the way of the
dirtiest hack on earth :-) can only address controller instance
variables. So the question is - if I want to merely persist some
values through reloads and use the form helpers (they are times more
convenient than usual forms) the only way I can go about it is build
a custom container class that will mimick AR::Base?

Same about a login field. How do I somply persist the password and
login field input if the login fails for some reason?

Take for instance an "incremental search" form where you can select
stuff from the DB bu using a set of conditions - I would like the
menu positions and other inputs to persist between reload  (and use
the helpers).On a project I just finished I built a Finder object
that worked kind of like AR, but maybe there is a nicer way?

Or, maybe there gotta be a take 2 like this:

1. load the params into the flash
2. on redirect make these params available as an instance variable so
that helpers can get to it
3. make this instance variable have a class which does not raise
anything on method_missing, so that if form helpers
get to it and it is empty they just show nil values.

Ay advice? Right now all of the forms which are decoupled from AR in
my app are sort of deprived of all the Rails magic you can put to
some good use.

--
Julian "Julik" Tarkhanov