To store the combo box id value from one table another table in database+rails

Hi.
I am new in ruby on rails..............

Im using Two tables. one is Resortclass and another is Resortbasic.

Resortclass table using masterpage.View
<br><br>
<h3 align="center">Resort Classes</h3>
<table align="center">

<tr>
      <td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <%= paginating_links(@resort_classes) %>
       </td>

</tr>
</table>
<table align="center" border="1" cellpadding="5" cellspacing="0">
  <tr>
    <th>Resort Class</th>
    <th>Action</th>
  </tr>
  <ol>
<% @resort_classes.each do |resort_class| %>
  <tr>
    <td class="text1"><%=h resort_class.resortclass %></td>
    <td class="text1">
                      <%= link_to 'Show', resort_class %>
                      <%= link_to 'Edit', edit_resort_class_path
(resort_class) %>
                       <%= link_to 'Destroy', resort_class, :confirm
=> 'Are you sure?', :method => :delete %>
  </td>
  </tr>
<% end %>

</ol>
</table>
<table align="center">
  <tr>
     <td>
      <%= button_to 'Add', new_resort_class_path,:class=>'myButton'%>
     </td>
  </tr>
</table>

Resortclass is working and i need to the corresponding resortid value
and Im using five form and different tables and one controller is
Wizard controller

Resortbasic View Page

<% form_tag :action => 'wizard', :stage => @next_stage do %>

<br><br>
   <h3 align="center">Add Resort Basic</h3>
<table align="center">
    <tr>
        <td>
           <b>Resort Name</b>
        </td>
        <td>

            <%= text_field_tag :resortname %>
        </td>

    </tr>
    <tr>
        <td>
           <b>Resort Type</b>
       </td>
       <td>

           <!--%=f.collection_select(resort_basic.resorttypeid,
ResortType.find(:all),id,resorttype)%-->
           <%=select("resorttype", "resorttypeid", ResortType.find
(:all).collect {|p| [ p.resorttype, p.id ] })%>
       </td>
    </tr>

    <tr>
        <td>
           <b>Resort Class</b>
       </td>
       <td>
           <!--%=collection_select(:resortclassid, ResortClass.find
(:all),:id,:resortclass)%-->
           <%=select("resortclass", "resortclassid", ResortClass.find
(:all).collect {|p| [ p.resortclass, p.id ] })%>
       </td>
    </tr>
    <tr>
        <td>
           <b>Season</b>
       </td>
       <td>
           <!--%=collection_select(:seasonid, Season.find
(:all),:id,:seasontype)%-->
           <%=select("seasontype", "seasontypeid", Season.find
(:all).collect {|p| [ p.seasontype, p.id ] })%>
       </td>
    </tr>
    <tr>
        <td>
           <b>Website</b>
       </td>
       <td>
           <%= text_field_tag :website %>
       </td>
    </tr>
</table>
<table align="center">
    <tr>

       <td>

            <%= submit_tag "Next",:class =>'myButton' %>
     </td>

    </tr>
</table>
  <% end %>

Wizard controller

class WizardController < ApplicationController

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

     @resort_basic.resortclassid=params[:resortclass];

     @resort_basic.resortname=params[:resortname];

     @resort_basic.resorttypeid=params[:resorttype];

     @resort_basic.seasonid=params[:seasontype];

     @resort_basic.website=params[:website];

     @resort_basic.save()

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

    else

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

      @dummyObj.save()

     @resort_contactdetail = ResortContactdetail.new{}

     @resort_contactdetail.resortid=@dummyObj.id

     @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()

    end

    @next_stage = @stage + 1

    #@wizard_data = session[:wizard_data]

render :template => 'wizard\\stage'+@next_stage.to_s
  end
end

But i got the resortname and website value and i didn't get
resortclassid,resorttypeid value.

To store the combo box id value from one table another table in mysql
database+ruby on rails........................
Please help me...........

Thanks &Regards
Balaji

Check your logs to see what params are being submitted. Those combo
boxes will be in there, just not where you expect them

Fred

Hi…

My Resortclass application is

Field =>id: resortclass

Value=>1:aaaaa

2:bbbbb in store in resortclasses table

My Resortbasic application is

Field =>id: resortclassid

Value=>1:1

2:1 in store in resortbasics table

I select 2nd value is bbbb but it is stored the id value is 1and

I select 2nd value is aaaa but it is stored the id value is 1

So i doubt error in wizard controller section

@resort_basic.resortclassid=params[:resortclass];

Please check and help me sir

Thanks &regards

Balaji

Check again. I can assure you that resortclassid is not in params[:
resortclassid] but is somewhere else.
Don't flail around blindly, use the debugger to inspect the params
hash and you'll find out soon enough (or as a poor man's alternative
use
<%= debug(params)%> in the view to display all the parameters received

Fred

Hi

I used <%= debug(params)%> in the view to display the

!map:HashWithIndifferentAccess
controller: wizard
action: stage1

I can’t understand the error.Please anyone rectify the error.

Thanks &regards

Balaji

Hi

I used <%= debug(params)%> in the view to display the

!map:HashWithIndifferentAccess
controller: wizard
action: stage1

I can't understand the error.Please anyone rectify the error.

Just look in development.log. It shows you what params are received.
from that it should be clear.

Fred

Hi…

Good Morning

I enter the values are mahapalipuram ,bbbb is equal to ID value is 2 but i got value 1,and hide 2 values so i got Null,Null,www.mpm.com

I can’t understand the error.So if any one help me…

Thanks

Balaji

ActiveRecord::StatementInvalid in WizardController#wizard

Mysql::Error: #23000Column 'resorttypeid' cannot be null: INSERT INTO `resort_basics` (`resortclassid`, `resortname`, `resorttypeid`, `seasonid`, `website`) VALUES(1, 'mahapalipuram ', NULL, NULL, '[www.mpm.com](http://www.mpm.com)')

RAILS_ROOT: D:/RubyProjects/TestEcohols

Application Trace | Framework Trace | Full Trace

D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in `log'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in `execute'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:156:in `insert_sql'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:291:in `insert_sql'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:26:in `insert_with_query_dirty'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2272:in `create'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:226:in `create_with_callbacks'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/timestamp.rb:29:in `create_with_timestamps'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2238:in `create_or_update'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:213:in `create_or_update_with_callbacks'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1972:in `save'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:934:in `save_with_validation'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
app/controllers/wizard_controller.rb:42:in `wizard'
:1:in `start'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in `log'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in `execute'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:156:in `insert_sql'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:291:in `insert_sql'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:26:in `insert_with_query_dirty'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2272:in `create'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:226:in `create_with_callbacks'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/timestamp.rb:29:in `create_with_timestamps'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2238:in `create_or_update'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:213:in `create_or_update_with_callbacks'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1972:in `save'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:934:in `save_with_validation'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_with_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb:293:in `measure'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_with_rescue'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action_with_caching'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action_with_caching'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_with_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process_with_session_management_support'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in `log'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in `execute'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:156:in `insert_sql'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:291:in `insert_sql'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:26:in `insert_with_query_dirty'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2272:in `create'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:226:in `create_with_callbacks'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/timestamp.rb:29:in `create_with_timestamps'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2238:in `create_or_update'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:213:in `create_or_update_with_callbacks'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1972:in `save'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:934:in `save_with_validation'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save_with_transactions'
app/controllers/wizard_controller.rb:42:in `wizard'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_with_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb:293:in `measure'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_with_rescue'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action_with_caching'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action_with_caching'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_with_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process_with_session_management_support'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
:1:in `start'

Request

Parameters:

 {"authenticity_token"=>"ad873f6fad6c67d5457b476d1130c5a966d74684",
"resortname"=>"mahapalipuram ",
"resorttype"=>{"resorttypeid"=>"2"},
"resortclass"=>{"resortclassid"=>"2"},
"seasontype"=>{"seasontypeid"=>"2"},
"website"=>"[www.mpm.com](http://www.mpm.com) ",
"commit"=>"Next"}

Show session dump

--- :resort_basicObj: &id001 !ruby/object:ResortBasic
  new_record: false
  attributes:     resortclassid: !map:HashWithIndifferentAccess
      resortclassid: !str 2
    resorttypeid: !map:HashWithIndifferentAccess
      resorttypeid: !str 2
    resortname: mahapalipuram resort
    seasonid: !map:HashWithIndifferentAccess
      seasontypeid: !str 2
    id: 1
    website: [www.mpm.com](http://www.mpm.com)
  errors: !ruby/object:ActiveRecord::Errors
    errors: {}
    base: *id001
  attributes_cache: {}
:csrf_id: 4da1a45d719ec0423735f506d5aa6c98
flash: !map:ActionController::Flash::FlashHash {}

Response

Headers:

 {"Cache-Control"=>"no-cache",
"cookie"=>[]}

Hi

i got error…

Mysql::Error: #23000Column 'resorttypeid' cannot be null: INSERT INTO `resort_basics` (`resortclassid`, `resortname`, `resorttypeid`, `seasonid`, `website`) VALUES(1, 'mahapalipuram ', NULL, NULL, '[www.mpm.com](http://www.mpm.com/)')

RAILS_

please help me …

Thanks

balaji

The answer is right here. params[:resortname] exists, but params
[:resorttypeid] doesn't - it's inside params[:resorttype] (because
that's what the select helper you're using does)

Fred

Hi

Textbox coding in controller

@resort_basic.resortname=params[:resortname];

is working well and i got the value…

Combo box coding in controller

  1. @resort_basic.resortclass[resortclassid]=params[:resortclass];

got error in 1st code : undefined method `resortclass’ for #ResortBasic:0x5ba21a

  1. @resort_basic.resortclassid=params[:resortclass[resortclassid]];

got error in 2nd code :undefined local variable or method`resortclassid’for #WizardController:0x7310db

  1. @resort_basic.resortclassid=params[:resortclass];

got error in 3rd code :id value stored in 1 but id value is not store 2

correct id value is 2…

so please help me sir…

Thanks &Regards

balaji.R

Hi

Textbox coding in controller

@resort_basic.resortname=params[:resortname];

is working well and i got the value.......................

Combo box coding in controller

1. @resort_basic.resortclass[resortclassid]=params[:resortclass];

got error in 1st code : undefined method `resortclass' for
#<ResortBasic:0x5ba21a>

2. @resort_basic.resortclassid=params[:resortclass[resortclassid]];

got error in 2nd code :undefined local variable or
method`resortclassid'for #<WizardController:0x7310db>

3. @resort_basic.resortclassid=params[:resortclass];

got error in 3rd code :id value stored in 1 but id value is not
store 2

correct id value is 2........................

This is really super basic ruby - you'll be wasting a lot of time if
you don't go back and read the basics. It should be obvious from
what's below that
params[:resortclass][:resorttypeid]

grabs the right parameter id.
You're also creating rather more work for your self than you need. Get
it right and you can just do resort_basic = ResortBasic.new
params[:resort_basic].
http://guides.rubyonrails.org/form_helpers.html has some details on
that, also see the documentation for form_for etc...

Fred

Hi Frederick Cheung

Good Evening…

Your Guideness very useful for me and I got the combo box id value…

Thank you sir…

Thanks & Regards

Balaji.R

Hi Frederick Cheung

I use one controller+five tables+one detailed form( it includes five form or page).First page enter the data and click next button(get the data using session) and final to click save button to store all data to corresponding table.

But controller page code

Hi Frederick Cheung

Good Morning

I got the error:Template missing …

No increment stage…and please help me…

Thanks &regards

Balaji.R

Hi Frederick Cheung

Good Morning

use one controller+five tables+one detailed form( it includes five form or page).First page enter the data and click next button(get the data using session) and final to click save button to store all data to corresponding table.

Please give idea and help me…

Thanks

Balaji

Hi Frederick Cheung

use one controller+five tables+one detailed form( it includes five form or page).First page enter the data and click next button(get the data using session) and final to click save button to store all data to corresponding table. Please give an example code

Please give idea and help me…

Thanks

Balaji

Hi Frederick Cheung

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.

code

Hi Thorsten Müller

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.

controller code

Stage 2 tries to access (among other things) params[:district][:districtid] which is not one of the parameters submitted.

Fred

Hi Frederick Cheung

im using the same code and final change code(remove the hide )

end

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

I got the bugs:

NoMethodError in WizardController#wizard

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.save

RAILS_ROOT: D:/RubyProjects/TestEcohols

Application Trace | Framework Trace | Full Trace

app/controllers/wizard_controller.rb:117:in `wizard'
:1:in `start'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_with_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb:293:in `measure'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_with_rescue'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action_with_caching'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action_with_caching'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_with_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process_with_session_management_support'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
app/controllers/wizard_controller.rb:117:in `wizard'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_with_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/benchmark.rb:293:in `measure'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_with_rescue'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action_with_caching'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action_with_caching'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_with_filters'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process_with_session_management_support'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
:1:in `start'

Request

Parameters:

 {"authenticity_token"=>"09ab9bb40356d304564035a6b4a160d49dfccd66",
"firstname"=>"raja",
"lastname"=>"ram",
"designation"=>"director",
"email_id"=>"raja@gmail.com ",
"mobile"=>"9458289369",
"telephone1"=>"41252452",
"telephone2"=>"452865858",
"fax"=>"425828825",
"commit"=>"Next",
"stage"=>"2"}
I can't understand the bugs.So please help me **Frederick Cheung**
Thanks & Regards
Balaji