Ruby on Rails Friday, February 25, 2011

The error is from the time select that rails provides if you have validations on that.

Top part of the model:

class TourType < ActiveRecord::Base
  acts_as_reportable
    has_many :tours, :dependent => :destroy
    belongs_to :image, :class_name => "TourTypeImage"
    belongs_to :usual_tour_confirmation, :class_name => "TourConfirmation"
  belongs_to :page
 
  validates_presence_of :name, :usual_start_time, :usual_end_time, :abbreviation, :usual_tour_confirmation, :usual_cutoff
    validates_numericality_of :usual_price_number, :greater_than => 0.00
    validates_numericality_of :usual_capacity
    acts_as_list
    validates_presence_of :page_id, :if => lambda{|tt|tt.active?}
    validates_each :usual_start_time do |r, a, v|
    r.errors.add(a, 'must be before usual end time') if r.usual_end_time <= v
  end
 
  end

Here is the full error:

ActiveRecord::MultiparameterAssignmentErrors (1 error(s) on assignment of multiparameter attributes):
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activerecord-2.2.2/lib/active_record/base.rb:2892:in `execute_callstack_for_multiparameter_attributes'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activerecord-2.2.2/lib/active_record/base.rb:2853:in `assign_multiparameter_attributes'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activerecord-2.2.2/lib/active_record/base.rb:2591:in `attributes='
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activerecord-2.2.2/lib/active_record/base.rb:2283:in `initialize'
    /app/models/tour_type.rb:72:in `new'
    /app/models/tour_type.rb:72:in `create_type'
    /app/controllers/admin/tour_types_controller.rb:26:in `create'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in `send'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in `perform_action_without_filters'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:in `call_filters'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/rescue.rb:136:in `perform_action_without_caching'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activerecord-2.2.2/lib/active_record/query_cache.rb:8:in `cache'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in `send'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in `process_without_filters'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:in `process_without_session_management_support'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:in `sass_old_process'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/haml-2.2.20/lib/sass/plugin/rails.rb:20:in `process_without_compass'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/chriseppstein-compass-0.8.17/lib/compass/app_integration/rails/action_controller.rb:7:in `process_without_test'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:18:in `process'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/base.rb:392:in `process'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:183:in `handle_request'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `synchronize'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/rails-2.2.2/lib/webrick_server.rb:103:in `handle_dispatch'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/rails-2.2.2/lib/webrick_server.rb:74:in `service'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/server.rb:162:in `start'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/server.rb:95:in `start'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/server.rb:92:in `each'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/server.rb:92:in `start'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/server.rb:23:in `start'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/webrick/server.rb:82:in `start'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/rails-2.2.2/lib/webrick_server.rb:60:in `dispatch'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/rails-2.2.2/lib/commands/servers/webrick.rb:66
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
    /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/rails-2.2.2/lib/commands/server.rb:49
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    /Users/chabgood/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
    script/server:3

Rendered /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/_trace (147.1ms)
  [4;36;1mSale Columns (43.1ms) [0m   [0;1mSHOW FIELDS FROM `sales` [0m
Rendered /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/_request_and_response (335.7ms)
Rendering /Users/chabgood/.rvm/gems/ruby-1.8.7-p330@savor_seattle/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/layout.erb (internal_server_error)
 

On Friday, February 25, 2011 11:17:25 PM UTC-6, bacrossland wrote:

On Fri, Feb 25, 2011 at 11:05 PM, Me <chab...@gmail.com> wrote:
Ya I know, but I am getting this, ActiveRecord::MultiparameterAssignmentErrors (1 error(s) on assignment of multiparameter attributes): with just the TourType.new for my time select, which is totally separate error from the validations.

Paste the full error output, your model, and your form from the view. The error is coming because you are assigning too many, too few, and/or the incorrect type of assignments that the model expects for a new record. Once you show me the stuff I listed I can get a better idea of which it is. 

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

No comments:

Post a Comment