One Controller+Five tables+ Five forms( 5 pages)+One model

Hi

I have 5 forms(5 stages) to create my rails application.im using One
Controller+Five tables+ Five forms( 5 pages)+One model/

1st form: to enter the data and click the next button.To get the values
in
session.
2nd form: to enter the data and click the next button.To get the values
in
session.
3rd form: to enter the data and click the next button.To get the values
in
session.
4th form: to enter the data and click the next button.To get the values
in
session.
5th form: to enter the data and click the create button.To store the
data to
corresponding table.

class WizardController < ApplicationController

def wizard
if params[:stage].nil?
@stage = 1
@resort_basic = ResortBasic.new {}

@resort_basic.resortclassid=params[:resortclass][:resortclassid]
@resort_basic.resortname=params[:resortname]
@resort_basic.resorttypeid=params[:resorttype][:resorttypeid]
@resort_basic.seasonid=params[:seasontype][:seasontypeid]
@resort_basic.website=params[:website]

@resort_basic.save()

session[:resort_basicObj] = @resort_basic # Or whatever model is
storing
your stuff

elsif params[:stage].to_i ==1

# @stage = params[:stage].to_i==1
 @dummyObj = session[:resort_basicObj]

# @dummyObj.save()


 @resort_contactdetail = ResortContactdetail.new{}

 @[email protected]

 @resort_contactdetail.firstname= params[:firstname]
 @resort_contactdetail.lastname= params[:lastname]
 @resort_contactdetail.designation= params[:designation]
 @resort_contactdetail.email_id= params[:email_id]
 @resort_contactdetail.mobile= params[:mobile]
 @resort_contactdetail.telephone1= params[:telephone1]
 @resort_contactdetail.telephone2= params[:telephone2]
 @resort_contactdetail.fax= params[:fax]

# @resort_contactdetail.save()

session[:resort_contactdetailObj] = @resort_contactdetail

elsif params[:stage].to_i ==2

# @stage = params[:stage].to_i ==2
 @dummyObj1 = session[:resort_contactdetailObj]

@dummyObj1.save()

 @resort_address = ResortAddress.new{}

# @resort_add[email protected]

 @resort_address.street= params[:street]
 @resort_address.area= params[:area]
 @resort_address.districtid= params[:district][:districtid]
 @resort_address.cityid= params[:city][:cityid]
 @resort_address.stateid= params[:state][:stateid]
 @resort_address.countryid= params[:country][:countryid]
 @resort_address.pincode= params[:pincode]

# @resort_address.save()

session[:resort_addressObj] = @resort_address

elsif params[:stage].to_i ==3

# @stage = params[:stage].to_i ==3
# @dummyObj2 = session[:resort_addressObj]

# @dummyObj2.save()

 @resort_additionaldetail = ResortAddtionaldetail.new{}

# @[email protected]

 @resort_additionaldetail.aminity= params[:aminity]
 @resort_additionaldetail.directions= params[:directions]
 @resort_additionaldetail.transport= params[:transport]
 @resort_additionaldetail.map= params[:map]
 @resort_additionaldetail.pickupoffered= params[:pickupoffered]
 @resort_additionaldetail.email_id= params[:email_id]


 #@resort_additionaldetail.save <%[email protected]_additionaldetail.save>()

session[:resort_additionaldetailObj] = @resort_additionaldetail

else params[:stage].to_i ==4

# @dummyObj3 = session[:resort_additionaldetailObj]

# @dummyObj3.save()

 @resort_accomodation = ResortAccomodation.new{}

# @[email protected]

 @resort_accomodation.roomtypeid= params[:roomtype][:roomtypeid]
 @resort_accomodation.singleoccupancyrate= 

params[:singleoccupancyrate]
@resort_accomodation.doubleoccupancyrate=
params[:doubleoccupancyrate]
@resort_accomodation.extrapersoncost= params[:extrapersoncost]
@resort_accomodation.numberofrooms= params[:numberofrooms]
@resort_accomodation.availablerooms= params[:availablerooms]

 @resort_basic.save()
 @resort_contactdetail.save()
 @resort_address.save()
 @resort_additionaldetail.save()
 @resort_accomodation.save()

end

@next_stage = @stage + 1

#@wizard_data <%[email protected]_data> = session[:wizard_data]

render :template => ‘wizard\stage’[email protected]_stage.to_s
end
end

i used the code and not stored the value in database.im only doing this
rails project.
Please help me.

Thanks and Regards

Balaji

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs