Forum: Ruby on Rails Intercepting form submission

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
9f4a65c520a69cd357d830661e172272?d=identicon&s=25 JannaB (Guest)
on 2009-05-28 14: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.
D188e591eac11021329b8821a5f954c7?d=identicon&s=25 Ar Chron (railsdog)
on 2009-05-28 14: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.