Hi *Thorsten Müller*

your guideness very helpful for me. i used the code but i got bugs.

code
----------------------------------------------------------------------------------------------------------------------------------

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{}

    # @[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]


     [EMAIL PROTECTED]()

    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

    [EMAIL PROTECTED] = session[:wizard_data]

 render :template => 'wizard\\stage'[EMAIL PROTECTED]
  end
end
I have 5 forms(5 stages) to create my rails application.

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.



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

Thanks and Regards

Balaji


On 12/3/08, Thorsten Müller <[EMAIL PROTECTED]> wrote:
>
>
> I do not really understand, what you are doing here, but:
>
> You are using "else if" without a condition several times,
> beneath the fact that the correct ruby syntax is elsif
>
> Then Ruby would interpret the following line:
> @stage = params[:stage].to_i
> as condition and the outcome of this is most likely not
> what you would expect.
>
> And all those "end' show too, that the structure is a bit weird.
>
> I think, what you want to do would need something like this:
>
> def wizard
> if params[:stage].nil?
> ...
> elsif params[:stage].to_i == 1
> ...
> elsif params[:stage].to_i == 2
> ...
> else
> ...
> end
> render :template => 'wizard\\stage'[EMAIL PROTECTED]
> end
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to