has_many_polymorphs 插件给了我这个错误
这是我尝试创建新模型时日志中的错误:
/rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/configuration.rb:7: Configuration is not a class (TypeError)
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs.rb:23
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/init.rb:2
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/plugin.rb:81
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:50:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:134:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
from /rubyprograms/dreamstill/config/environment.rb:5
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:103:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:103:in `require_environment!'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/commands.rb:16
from script/rails:6:in `require'
from script/rails:6
它来自 has_many_polymorphs 插件...
这里是 config/environment.rb:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dreamstill::Application.initialize!
这是 /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/ has_many_polymorphs/configuration.rb
:
module Rails #:nodoc:
class Configuration
def has_many_polymorphs_options
::HasManyPolymorphs.options
end
def has_many_polymorphs_options=(hash)
::HasManyPolymorphs.options = HashWithIndifferentAccess.new(hash)
end
end
end
This is the error in my logs when I try to create a new model:
/rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/configuration.rb:7: Configuration is not a class (TypeError)
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs.rb:23
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.4/lib/active_support/dependencies.rb:239:in `require'
from /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/init.rb:2
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/plugin.rb:81
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:50:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:134:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
from /rubyprograms/dreamstill/config/environment.rb:5
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:103:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:103:in `require_environment!'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.4/lib/rails/commands.rb:16
from script/rails:6:in `require'
from script/rails:6
It's from the has_many_polymorphs plugin...
here is config/environment.rb:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dreamstill::Application.initialize!
This is /rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs/configuration.rb
:
module Rails #:nodoc:
class Configuration
def has_many_polymorphs_options
::HasManyPolymorphs.options
end
def has_many_polymorphs_options=(hash)
::HasManyPolymorphs.options = HashWithIndifferentAccess.new(hash)
end
end
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
快速回答:
您的
has_many_polymorphs
插件已损坏。 上的environment.rb
文件中,我认为您已将其包含在第 5 行UPD
如您所见
/rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/ lib/has_many_polymorphs.rb:23
has_many_polymorphs.rb
文件 n 行有错误23.修复它:D。或者不要使用损坏的插件。The quick answer:
Your
has_many_polymorphs
plugin is broken. And I think you've included it in yourenvironment.rb
file on LINE 5UPD
as you can see
/rubyprograms/dreamstill/vendor/plugins/has_many_polymorphs/lib/has_many_polymorphs.rb:23
there is an error inhas_many_polymorphs.rb
file n line 23. Fix it :D. Or don't use broken plugins.