Forum: Ruby on Rails Intercepting form submission

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.
JannaB (Guest)
on 2009-05-28 16:16
(Received via mailing list)
Where (what function name must I insert in my controller, I assume)
can I obtain the selected value from a field in a form, to process and
change it before it gets written to the model's table in the db?
Thanks, Janna B.
Ar C. (Guest)
on 2009-05-28 16:55
Well, you *could* choose the ugly path and just place that code in the
controller create and/or update methods, after your model is
reconstituted from the params.

Or choose a better path and place that code in a method in the model,
and define a before_save in the model that invokes the method
(before_save is called for either create or update).
This topic is locked and can not be replied to.