Forum: Ruby on Rails Dealing with Form Data

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.
C7534a2092e4aea7b6d1b3a5e699af6f?d=identicon&s=25 Andrew Macdonald (andrewm)
on 2006-03-28 20:49
Google lets me down once again :-)

Coming from a PHP background I know I can take submitted form data, mix
it, mash it and put it together in very odd ways.  In other words do
this.

$title = "My Title"
$sub_title = "My Sub Title"
$full_title = $title . "-" . $sub_table

And submit $full_title to the database.  I have yet to find a solution
for this in Rails - I know there is one but being new to all this I am
probably just missing it.  Basically I want to take form data - mash it
together and then submit it to the database.

Does this go in def create? If not where.  Thanks.

AndrewM
Dcc2d3a8038cd47219af0eebe0a8a78e?d=identicon&s=25 Carl Fyffe (Guest)
on 2006-03-28 21:08
(Received via mailing list)
Grab them while they are still params.

@record.full_title = params[:title] + "-" + params[:sub_title]
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-03-29 03:14
(Received via mailing list)
In the controller, take the form data directly into
the model. Put the temporary data into non-DB backed
attributes, then call a method to mix and mash the
form data into the DB backed attributes.

--
-- Tom Mornini
This topic is locked and can not be replied to.