获取“ModelName”的未定义方法`param_key':ActiveModel :: Name

时间:2013-10-18 08:05:23

标签: ruby-on-rails ruby gem refinerycms

我的应用程序运行正常,使用ruby 1.9.2 -p290,rails 3.0.10& refinerycms 1.0.9。 我已经使用acts_as_commentable gem来评论。我添加了一个新的gem并运行bundle install,之后我无法添加注释。抛出错误

undefined method `param_key' for "ModelName":ActiveModel::Name

我还评论了新添加的gem并运行bundle install。但问题仍然存在。以下是结果     捆绑秀

        * abstract (1.0.0)
        * actionmailer (3.0.10)
        * actionpack (3.0.10)
        * active_utils (2.0.1)
        * activemerchant (1.39.2)
        * activemodel (3.0.10)
        * activerecord (3.0.10)
        * activeresource (3.0.10)
        * activesupport (3.0.10)
        * acts-as-taggable-on (2.4.1)
        * acts_as_commentable (4.0.0)
        * acts_as_indexed (0.8.3)
        * acts_as_list (0.1.9)
        * addressable (2.3.5)
        * after_load (0.0.1)
        * ajaxful_rating (3.0.0.beta6)
        * ansi (1.4.3)
        * archive-tar-minitar (0.5.2)
        * arel (2.0.10)
        * awesome_nested_set (2.1.6)
        * awesome_print (1.2.0)
        * aws-s3 (0.6.3)
        * babosa (0.3.11)
        * bcrypt-ruby (3.1.2)
        * browser (0.2.1)
        * builder (2.1.2)
        * bundler (1.3.5)
        * capybara (1.1.4)
        * capybara-webkit (0.12.1)
        * childprocess (0.3.9)
        * columnize (0.3.6)
        * cucumber (1.3.8)
        * cucumber-rails (1.0.6)
        * database_cleaner (1.2.0)
        * decent_exposure (2.3.0)
        * devise (1.4.9)
        * devise_invitable (0.6.0)
        * diff-lcs (1.2.4)
        * dragonfly (0.9.12)
        * erubis (2.6.6)
        * exception_notification (3.0.1)
        * excon (0.27.6)
        * factory_girl (4.2.0)
        * factory_girl_rails (4.2.1)
        * ffi (1.9.0)
        * filters_spam (0.3)
        * fog (1.16.0)
        * formatador (0.2.4)
        * friendly_id_globalize3 (3.2.1.6)
        * fuubar (1.2.1)
        * galetahub-simple_captcha (0.1.3)
        * gherkin (2.12.2)
        * globalize3 (0.3.0)
        * hashr (0.0.22)
        * httparty (0.11.0)
        * i18n (0.5.0)
        * jquery-rails (1.0.19)
        * json (1.8.1)
        * json_pure (1.8.1)
        * kgio (2.8.1)
        * launchy (2.3.0)
        * linecache19 (0.5.12)
        * mail (2.2.20)
        * mime-types (1.25)
        * mini_portile (0.5.1)
        * money (5.0.0)
        * multi_json (1.8.2)
        * multi_test (0.0.2)
        * multi_xml (0.5.5)
        * mysql2 (0.2.20)
        * net-scp (1.1.2)
        * net-ssh (2.7.0)
        * nokogiri (1.6.0)
        * orm_adapter (0.0.7)
        * paper_trail (2.7.2)
        * pickle (0.4.11)
        * polyglot (0.3.3)
        * puma (2.6.0)
        * pushmeup (0.1.2)
        * rack (1.2.8)
        * rack-cache (1.2)
        * rack-mount (0.6.14)
        * rack-rewrite (1.0.2)
        * rack-test (0.5.7)
        * rails (3.0.10)
        * railties (3.0.10)
        * raindrops (0.12.0)
        * rake (10.1.0)
        * rdoc (3.12.2)
        * refinerycms (1.0.9)
        * refinerycms-authentication (1.0.9)
        * refinerycms-banners (1.0)
        * refinerycms-base (1.0.9)
        * refinerycms-blog (1.6.2)
        * refinerycms-calendar (1.1.0)
        * refinerycms-core (1.0.9)
        * refinerycms-dashboard (1.0.9)
        * refinerycms-generators (1.0.4)
        * refinerycms-i18n (0.9.9.16)
        * refinerycms-images (1.0.9)
        * refinerycms-inquiries (1.0.1)
        * refinerycms-memberships (1.0)
        * refinerycms-news (1.2.0)
        * refinerycms-newsletter_sponsers (1.0)
        * refinerycms-search (0.9.8)
        * refinerycms-settings (1.0.9)
        * refinerycms-testing (1.0.9)
        * rest-client (1.6.7)
        * routing-filter (0.3.1)
        * rspec (2.14.1)
        * rspec-core (2.14.6)
        * rspec-expectations (2.14.3)
        * rspec-instafail (0.2.4)
        * rspec-mocks (2.14.4)
        * rspec-rails (2.14.0)
        * ruby-debug-base19 (0.11.25)
        * ruby-debug19 (0.11.6)
        * ruby-hmac (0.4.0)
        * ruby-progressbar (1.2.0)
        * ruby_core_source (0.1.5)
        * rubyzip (0.9.9)
        * selenium-webdriver (2.35.1)
        * sendgrid (1.2.0)
        * seo_meta (1.1.1)
        * shoulda-matchers (2.4.0)
        * slim (2.0.1)
        * spork (0.9.2)
        * sqlite3 (1.3.8)
        * temple (0.6.7)
        * thor (0.14.6)
        * tilt (1.4.1)
        * tire (0.6.1)
        * treetop (1.4.15)
        * truncate_html (0.9.2)
        * tzinfo (0.3.38)
        * unicode (0.4.4)
        * unicorn (4.4.0)
        * warden (1.0.6)
        * websocket (1.0.7)
        * will_paginate (3.0.5)
        * xml-simple (1.1.2)
        * xpath (0.1.4)

以下是控制台上显示的错误消息

Started POST "/comments" for 192.168.2.170 at 2013-10-16 10:24:35 +0000
Processing by CommentsController#create as HTML
Parameters: {"utf8"=>"â", "authenticity_token"=>"Aql7Dz5cfx96Yi8JpBH5wIux+EGDdTGh98ksA97CbN4=", "comment"=>{"comment"=>"Test comment", "commentable_id"=>"1518", "commentable_type"=>"AuditProgram"}, "commit"=>"Create Comment", "locale"=>:en}

Exception, redirecting: undefined method `param_key' for "AuditProgram":ActiveModel::Name
Rendered public/404.html within layouts/application (313.7ms)
Completed 404 Not Found in 680ms (Views: 313.1ms | ActiveRecord: 121.3ms)

2 个答案:

答案 0 :(得分:1)

尝试在模型/类中添加此行

  

扩展ActiveModel :: Naming

答案 1 :(得分:1)

通过降级 decent_exposure gem来解决问题。

由于 decent_exposure gem已升级到其最新版本而引发此问题,我的应用程序env不支持该版本,并且它也由refinerycms内部使用。

使用我的应用程序环境支持的版本将gem明确添加到 Gemfile 中。