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 -- Posted via http://www.ruby-forum.com/.
Grab them while they are still params. @record.full_title = params[:title] + "-" + params[:sub_title] On 3/28/06, Andrew Macdonald <amacdonald@technomuses.ca> wrote:> 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
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 On Mar 28, 2006, at 11:00 AM, Carl Fyffe wrote:> Grab them while they are still params. > > @record.full_title = params[:title] + "-" + params[:sub_title] > > On 3/28/06, Andrew Macdonald <amacdonald@technomuses.ca> wrote: >> 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 >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails