我正在创建一个表单,并希望实现多对多关联。第一个工作正常,但在我再添加两个之后,我得到了这个内部服务器错误。 即使我删除了has_many代码片段,该网站仍然无法正常工作。我的错误在哪里?
Started GET "/clinics" for 127.0.0.1 at Sat Jul 07 20:25:32 +0200 2012
ArgumentError (wrong number of arguments (3 for 0)):
Error during failsafe response: wrong number of arguments (1 for 0)
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/actionpack-3.1.3/lib/action_view/base.rb:204:in `initialize'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/actionpack-3.1.3/lib/action_dispatch/middleware/show_exceptions.rb:81:in `rescue_action_locally
'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/actionpack-3.1.3/lib/action_dispatch/middleware/show_exceptions.rb:69:in `render_exception'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/actionpack-3.1.3/lib/action_dispatch/middleware/show_exceptions.rb:59:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/railties-3.1.3/lib/rails/rack/logger.rb:13:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rack-1.3.6/lib/rack/methodoverride.rb:24:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rack-1.3.6/lib/rack/runtime.rb:17:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/activesupport-3.1.3/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rack-1.3.6/lib/rack/lock.rb:15:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/actionpack-3.1.3/lib/action_dispatch/middleware/static.rb:53:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/railties-3.1.3/lib/rails/engine.rb:456:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rack-1.3.6/lib/rack/content_length.rb:14:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/railties-3.1.3/lib/rails/rack/log_tailer.rb:14:in `call'
c:/jruby-1.6.5/lib/ruby/gems/1.8/gems/rack-1.3.6/lib/rack/handler/webrick.rb:59:in `service'
c:/jruby-1.6.5/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
c:/jruby-1.6.5/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
c:/jruby-1.6.5/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
org/jruby/RubyProc.java:270:in `call'
org/jruby/RubyProc.java:224:in `call'
Started GET "/clinics" for 127.0.0.1 at Sat Jul 07 20:51:56 +0200 2012
ArgumentError (wrong number of arguments (3 for 0)):
我会发布所有模特:
class Clinic < ActiveRecord::Base
attr_accessible :name, :born_on, :clinic, :menopause, :menodate, :pregnancies, :preg_nr, :hormones, :carcinomes, :who_carci, :digni, :size, :calci, :makro, :mikro, :preresult, :enr, :operation_ids, :mamma, :resection, :lkdissektion_ids, :other_diss, :faszie, :pectoralis, :localization_ids
has_many :loca_hms
has_many :localizations, :through => :loca_hms
has_many :op_hms
has_many :operations, :through => :op_hms
has_many :lkdiss_hms
has_many :lkdissektions, :through => :lkdiss_hms
end
class Operation < ActiveRecord::Base
attr_accessible :name
has_many :op_hms
has_many :clinics, :through => :op_hms
end
class OpHm < ActiveRecord::Base
attr_accessible :clinic_id, :operation_id
belongs_to :clinic
belongs_to :operation
end
class Localization < ActiveRecord::Base
attr_accessible :name
has_many :loca_hms
has_many :clinics, :through => :loca_hms
end
class LocaHm < ActiveRecord::Base
attr_accessible :clinic_id, :localization_id
belongs_to :clinic
belongs_to :localization
end
class Lkdissektion < ActiveRecord::Base
attr_accessible :name
has_many :lkdiss_hms
has_many :clinics, :through => :lkdiss_hms
end
class LkdissHm < ActiveRecord::Base
attr_accessible :clinic_id, :lkdissektion_id
belongs_to :clinic
belongs_to :lkdissektion
end
答案 0 :(得分:0)
我发现了问题:rake db:migrate命令搞砸了。我不得不放弃我的整个数据库和db:create / db:migrate再次迁移。现在它的工作就像一个魅力!