ActiveRecord::StatementInvalid in RespondentsController ...

shoulderscobblerInternet and Web Development

Feb 2, 2013 (4 years and 9 months ago)

130 views

ActiveRecord::StatementInvali
d in
RespondentsController#upd_p
ersonal

Mysql::Error: Duplicate entry '5' for key 1: INSERT INTO
respondents_responsabilities (`respondent_id`, `id`,
`responsability_id`) VALUES (4, 5, 5)

RAILS_ROOT: ./../config/..

Application Trace

|
Framework Trace

|
Full Trace


#
{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/connection_a
dapters/abstract_adapter.rb:128:in `log'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/connection_a
dapters/mysql_adapter.rb:243:in `execute'

#{RAILS_ROOT}/vendor/rails/activer
ecord/lib/active_record/associations
/has_and_belongs_to_many_association.rb:132:in `insert_record'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations
/association_collection.rb:26:in `concat'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/a
ctive_record/associations
/association_collection.rb:23:in `each'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations
/association_collection.rb:23:in `concat'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/connection_a
dapters/a
bstract/database_statements.rb:59:in `transaction'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/transactions
.rb:95:in `transaction'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/transactions
.rb:121:in `transaction'

#{RAILS_ROOT}/ve
ndor/rails/activerecord/lib/active_record/associations
/association_collection.rb:22:in `concat'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations
/association_collection.rb:145:in `replace'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/ac
tive_record/connection_a
dapters/abstract/database_statements.rb:59:in `transaction'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/transactions
.rb:95:in `transaction'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/transactions
.rb:121:
in `transaction'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations
/association_collection.rb:143:in `replace'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations
.rb:950:in `responsabilities='

#{RAILS_ROOT}/vendor/rai
ls/activerecord/lib/active_record/associations
.rb:960:in `send'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations
.rb:960:in `responsability_ids='

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/base.rb:1672
:in `send'

#{RAILS_
ROOT}/vendor/rails/activerecord/lib/active_record/base.rb:1672
:in `attributes='

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/base.rb:1671
:in `each'

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/base.rb:1671
:in `attributes='

#{RAILS
_ROOT}/app/controllers/respondents_controller.rb:12:in
`upd_personal'

Request

Parameters
: {"respondent"=>{"responsability_ids"=>["5"],
"teaches_others"=>"", "country_id"=>"141", "years"=>"40",
"gender_id"=>"1", "teaches_mathematics"=>"true",
"
employ_place_ids"=>["6"], "grade_level_ids"=>["17"]},
"commit"=>"Send"}

Show session dump

Response

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