Forms in Ruby on Rails -
ive started using ruby on rails project of mine , have hit interesting walls. im using scaffolding instead of moving default show page after have entered data, want instead redirect page have created. key page form , half of form made of values entered in previous form. ive guessed have keep in memory instead of allowing written database. original idea query table , find last record multiple users not advisable. can help? examples great or point me in right direction im pretty familier c++, jave etc, understand computer jargon.
thanks
do care if data first form stored in database before going second form? if not can set create action in controller redirect new page want. depending on how managing user session, pull information user stored in first form. example if using devise handle session, have user enter username, email , password in first form, redirect profile form has separate email option. pre-populate field show user.email
, give user option create separate email profile. in new action profile add @profile.email = current_user.email
. keep in mind, allow user edit field separate both tables.
if want data entered in 2 forms point same database table, recommend looking @ using nested attributes. way, not have email columns in separate tables. railscasts has pretty episode on how this. http://railscasts.com/episodes/196-nested-model-form-part-1
Comments
Post a Comment