Forum: Ruby on Rails To store the combo box id value from one table another table in database+rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-01 10:25
(Received via mailing list)
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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-01 11:06
(Received via mailing list)
On 1 Dec 2008, at 09:18, bala <balajiece.rajagopal@gmail.com> wrote:

>

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

Fred
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-01 11:36
(Received via mailing list)
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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-01 12:15
(Received via mailing list)
On Dec 1, 10:35 am, "balaji rajagopal" <balajiece.rajago...@gmail.com>
wrote:
> 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
>
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
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-01 14:16
(Received via mailing list)
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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-01 14:44
(Received via mailing list)
On 1 Dec 2008, at 13:15, balaji rajagopal wrote:

> 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
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-02 06:36
(Received via mailing list)
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')

RAILS_ROOT: D:/RubyProjects/TestEcohols
Application Trace <http://localhost:3000/wizard/wizard#> | Framework
Trace<http://localhost:3000/wizard/wizard#>| Full
Trace <http://localhost:3000/wizard/wizard#>

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",
 "commit"=>"Next"}

 Show session dump <http://localhost:3000/wizard/wizard#>

---
: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
  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"=>[]}
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-02 10:33
(Received via mailing list)
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')

RAILS_


please help me ...........

Thanks
balaji
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-02 10:49
(Received via mailing list)
On Dec 2, 5:36 am, "balaji rajagopal" <balajiece.rajago...@gmail.com>
wrote:

>
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
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-02 11:19
(Received via mailing list)
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........................

so please help me sir..........

Thanks &Regards
balaji.R
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-02 11:28
(Received via mailing list)
On 2 Dec 2008, at 10:18, balaji rajagopal wrote:

> Combo box coding in controller
>
> 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
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-02 14:40
(Received via mailing list)
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
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-02 15:01
(Received via mailing list)
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
--------------------------------------------------------------------------------------------------------------------------------

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


   else if

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

  session[:resort_contactdetailObj] = @resort_contactdetail

 else if

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

     @dummyObj1.save()

     @resort_address = ResortAddress.new{}

     @resort_address.resortid=@dummyObj1.id

     @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

   else if

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

     @dummyObj2.save()

     @resort_additionaldetail = ResortAddtionaldetail.new{}

     @resort_additionaldetail.resortid=@dummyObj2.id

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

    session[:resort_additionaldetailObj] = @resort_additionaldetail

 else

     @stage = params[:stage].to_i
     @dummyObj3 = session[:resort_additionaldetailObj]

     @dummyObj3.save()

     @resort_accomodation = ResortAccomodation.new{}

     @resort_accomodation.resortid=@dummyObj3.id

     @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_accomodation.save()

  end

    @next_stage = @stage + 1

    #@wizard_data = session[:wizard_data]

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

I got the error:Template missing ...............

No increment stage..............and please help me...............

Thanks &regards

Balaji.R
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-03 06:18
(Received via mailing list)
Hi *Frederick Cheung*
                                      Good Morning




I got the error:Template missing ...............

No increment stage..............and please help me...............

Thanks &regards

Balaji.R
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-03 07:02
(Received via mailing list)
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
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-03 10:33
(Received via mailing list)
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
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-04 10:02
(Received via mailing list)
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
------------------------------------------------------------------------------------------------------------

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

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

  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_address.resortid=@dummyObj1.id

     @resort_address.street= params[:street]
     @resort_address.area= params[:area]
     @resort_address.cityid= params[:city][:cityid]
     @resort_address.districtid= params[:district][:districtid]
     @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{}

     #@resort_additionaldetail.resortid=@dummyObj2.id

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

   # session[:resort_additionaldetailObj] = @resort_additionaldetail

 else params[:stage].to_i ==4


    # @dummyObj3 = session[:resort_additionaldetailObj]

     #@dummyObj3.save()

     @resort_accomodation = ResortAccomodation.new{}

     #@resort_accomodation.resortid=@dummyObj3.id

     @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 = session[:wizard_data]

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

i enter the values but not stored  and i got 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.[]

RAILS_ROOT: D:/RubyProjects/TestEcohols
Application Trace <http://localhost:3000/wizard/wizard?stage=2#> |
Framework
Trace <http://localhost:3000/wizard/wizard?stage=2#> | Full
Trace<http://localhost:3000/wizard/wizard?stage=2#>

app/controllers/wizard_controller.rb:58: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:58: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"=>"balaji",
 "lastname"=>"raja",
 "designation"=>"director",
 "email_id"=>"raja@gmail.com",
 "mobile"=>"999946936",
 "telephone1"=>"4586854756",
 "telephone2"=>"458269556",
 "fax"=>"458256259",
 "commit"=>"Next",
 "stage"=>"2"}




Please give idea and help me...........

Thanks
Balaji
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-04 10:51
(Received via mailing list)
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
----------------------------------------------------------------------------------------------------------------------------


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

  session[:resort_contactdetailObj] = @resort_contactdetail

 elsif
   #params[:stage].to_i ==2

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

   #  @dummyObj1.save()

     @resort_address = ResortAddress.new{}

    # @resort_address.resortid=@dummyObj1.id

     @resort_address.street= params[:street]
     @resort_address.area= params[:area]
     @resort_address.cityid= params[:city][:cityid]
     @resort_address.districtid= params[:district][:districtid]
     @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
    # @dummyObj2 = session[:resort_addressObj]

    # @dummyObj2.save()

     @resort_additionaldetail = ResortAddtionaldetail.new{}

     #@resort_additionaldetail.resortid=@dummyObj2.id

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

    session[:resort_additionaldetailObj] = @resort_additionaldetail

 else
   @stage=params[:stage].to_i


    # @dummyObj3 = session[:resort_additionaldetailObj]

     #@dummyObj3.save()

     @resort_accomodation = ResortAccomodation.new{}

     #@resort_accomodation.resortid=@dummyObj3.id

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



  end

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

    @next_stage = @stage+1

    #@wizard_data = session[:wizard_data]

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



I enter the values in 5 forms but values not store corresponding table
in
database.
please give me any suggestions.

Thanks
Balaji
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-04 10:55
(Received via mailing list)
On 4 Dec 2008, at 09:01, balaji rajagopal wrote:
>  "telephone1"=>"4586854756",
>  "telephone2"=>"458269556",
>  "fax"=>"458256259",
>  "commit"=>"Next",
>  "stage"=>"2"}
>
>
Stage 2 tries to access (among other things)  params[:district]
[:districtid] which is not one of the parameters submitted.

Fred
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-04 11:16
(Received via mailing list)
*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 <http://localhost:3000/wizard/wizard?stage=2#> |
Framework
Trace <http://localhost:3000/wizard/wizard?stage=2#> | Full
Trace<http://localhost:3000/wizard/wizard?stage=2#>

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
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-04 11:49
(Received via mailing list)
*Hi Frederick Cheung*
** 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


I can't understand the bugs.So please help me *Frederick Cheung*

Thanks & Regards

Balaji
17da318855d695d08408ded419132012?d=identicon&s=25 Balaji Rajagopalan (balajirajagopalan)
on 2008-12-04 12:12
(Received via mailing list)
*Hi Frederick Cheung*
* *
*In my rails application, im using five forms to save the corresponding
5
tables and 1st form using next button to 4th form.final form using
create
button.To click the create button to save the values in databases.*

*  please give any idea.... i  can't understand the bugs*

*Please help me.............*

*Thanks*
*balaji*
This topic is locked and can not be replied to.