0

我的应用程序在 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)
4

2 回答 2

1

通过降级decent_exposure gem 修复了该问题。

之所以会出现此问题,是因为将体面曝光 gem 升级其最新版本,我的应用程序 env 不支持该版本,并且它在内部由炼油厂cms 使用。

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

于 2013-10-21T07:21:09.120 回答
1

尝试在您的模型/类中添加这一行

扩展 ActiveModel::Naming

于 2013-10-18T08:12:37.767 回答