Help, 1 error(s) on assignment of multiparameter attributes


#1

Hi everyone!

I just started learning Ruby on Rails about a week ago for a school
project, and can’t seem to find a solution for something.

I have this inside the form inside of edit_albums.rhtml:
<%= start_form_tag :action=>‘proccess_edit_album’, :id=>@album.id %>

Release Date: <%= datetime_select(:album, :release_date, :start_year
=> 1960) %>

and inside the controller:
def edit_album
@album = Album.find(params[‘id’])
end

def proccess_edit_album
@album = Album.find(params[:id])
@album.update_attributes(params[:album])
if 1
redirect_to :action=> ‘list_albums’
else
render :action => ‘edit_album’, :id=>params[‘id’]
end
end

but it gives me an error message, i dont get why, and i can’t seem to
find a fix to it.

Can anyone help me? I’ll appreciate it! :wink:


#2

Hi Trukin,

not an expert, but copy-pasting your error message might help.

Elise


#3

full trace:

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/
base.rb:2094:in execute_callstack_for_multiparameter_attributes' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:2074:inassign_multiparameter_attributes’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/
base.rb:1675:in attributes=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1591:inupdate_attributes’
#{RAILS_ROOT}/app/controllers/public_controller.rb:34:in
proccess_edit_album' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ base.rb:1095:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
base.rb:1095:in perform_action_without_filters' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ filters.rb:632:incall_filter’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
filters.rb:619:in perform_action_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
rescue.rb:83:in perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ base.rb:430:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
base.rb:430:in process_without_filters' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ filters.rb:624:inprocess_without_session_management_support’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
session_management.rb:114:in process' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/ base.rb:330:inprocess’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb: 113:inhandle_dispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:79:in
service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' c:/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:92:ineach’
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_server.rb:63:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/
webrick.rb:59
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:342:innew_constants_in’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/
dependencies.rb:495:in require' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' script/server:3 -e:4:inload’
-e:4

Request

Parameters: {“commit”=>“Edit”, “id”=>“1”, “album”=>{“artist”=>“The
Beatles”, “title”=>“Abbey Road”, “release_date(1i)”=>“1969”,
“release_date(2i)”=>“1”, “release_date(3i)”=>“1”, “genre”=>“Rock”,
“release_date(4i)”=>“12”, “release_date(5i)”=>“00”}}


#4

i commented the html tag inside the template:
Release Date: <%= datetime_select(:album, :release_date, :start_year
=> 1960) %>

to

1960) %>
-- > and now it works fine, i think it has to do something with the array passed within the POST, or maybe something else, im not sure, if anyone knows why, can you please explain me? Thanks

#5

ActiveRecord::MultiparameterAssignmentErrors in
PublicController#proccess_edit_album

1 error(s) on assignment of multiparameter attributes

read it wrong .