Ruby on rails “rails内部有bug的地方”;ActiveRecord::AssociationTypeMismatch“;?
正如rails指南所说,只有在存在关联不匹配的情况下才应引发Ruby on rails “rails内部有bug的地方”;ActiveRecord::AssociationTypeMismatch“;?,ruby-on-rails,activerecord,associations,Ruby On Rails,Activerecord,Associations,正如rails指南所说,只有在存在关联不匹配的情况下才应引发ActiveRecord::AssociationTypeMismatch,但在我的情况下,这是一个新问题 以下是例外情况: ActiveRecord::AssociationTypeMismatch (Service(#50963840) expected, got Service(#70493480)): 参数跟踪: Parameters: {"utf8"=>"✓", "authenticity_token"=>"
ActiveRecord::AssociationTypeMismatch
,但在我的情况下,这是一个新问题
以下是例外情况:
ActiveRecord::AssociationTypeMismatch (Service(#50963840) expected, got Service(#70493480)):
参数跟踪:
Parameters: {"utf8"=>"✓", "authenticity_token"=>"EyilRRem8MLjCrIGq5aovntlrWpCnVBbq/v0tO1HpD4=", "room"=>{"name"=>"room1", "service_ids"=>["2", "3", "4"], "location_id"=>"25", "capacity"=>"2"}, "multiselect_room_service_ids"=>"4", "commit"=>"Update Room", "id"=>"3"}
Creating scope :page. Overwriting existing method AdminUser.page.
AdminUser Load (0.2ms) SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 1 LIMIT 1
Room Load (0.2ms) SELECT `rooms`.* FROM `rooms` WHERE `rooms`.`id` = 3 LIMIT 1
Service Load (0.2ms) SELECT `services`.* FROM `services` WHERE `services`.`id` IN (2, 3, 4)
Service Load (0.1ms) SELECT `services`.* FROM `services` INNER JOIN `service_rooms` ON `services`.`id` = `service_rooms`.`service_id` WHERE `service_rooms`.`room_id` = 3 AND (is_active IS true)
(0.1ms) BEGIN
Creating scope :page. Overwriting existing method Service.page.
Creating scope :page. Overwriting existing method Category.page.
(0.1ms) ROLLBACK
Completed 500 Internal Server Error in 79ms
ActiveRecord::AssociationTypeMismatch (Service(#50963840) expected, got Service(#70493480)):
有人能解释一下可能出现的问题吗?这是我的错误。。我指的是服务关联,它不是真正的服务对象:)你能发布生成日志输出的代码吗?@DylanMarkow实际上
活动的\u admin
正在使用,但它应该像@room.update\u属性(params[:room])