聲明:我是Ruby on Rails新手。嘗試谷歌搜索和搜索StackOverflow沒有成功。未定義的局部變量或方法`acts_as_voteable'
我on Rails應用程序創建我的第一個Ruby和想採取「thumbs_up」插件,它類似於vote_fu和acts_as_voteable下Rails的作品3. https://github.com/brady8/thumbs_up
我按照安裝說明的優勢在上面的頁面上,當我運行「寶石列表」時,我看到安裝了thumbs_up插件。
我已經嘗試了「acts_as_voteable」混入增加,看起來像這樣一個模型:
class Foo < ActiveRecord::Base
validates :title, :presence => true
validates :description, :presence => true
acts_as_voteable
end
當我嘗試瀏覽我的應用我收到以下錯誤:
未定義的局部變量或方法`acts_as_voteable」爲#
堆棧跟蹤看起來不是非常有用的對我說:
activerecord (3.0.0) lib/active_record/base.rb:1016:in
method_missing' app/models/foo.rb:7 activesupport (3.0.0) lib/active_support/dependencies.rb:454:in
load' activesupport (3.0.0) lib/active_support/dependencies.rb:454:inload_file' activesupport (3.0.0) lib/active_support/dependencies.rb:591:in
new_constants_in' activesupport (3.0.0) lib/active_support/dependencies.rb:453:inload_file' activesupport (3.0.0) lib/active_support/dependencies.rb:340:in
require_or_load' activesupport (3.0.0) lib/active_support/dependencies.rb:491:inload_missing_constant' activesupport (3.0.0) lib/active_support/dependencies.rb:183:in
const_missing' activesupport (3.0.0) lib/active_support/dependencies.rb:181:ineach' activesupport (3.0.0) lib/active_support/dependencies.rb:181:in
const_missing' activesupport (3.0.0) lib/active_support/dependencies.rb:503:inload_missing_constant' activesupport (3.0.0) lib/active_support/dependencies.rb:183:in
const_missing' activesupport (3.0.0) lib/active_support/dependencies.rb:181:ineach' activesupport (3.0.0) lib/active_support/dependencies.rb:181:in
const_missing' app/controllers/foos_controller.rb:5:in `index'
有什麼想法?我似乎無法在解決此問題方面取得任何進展。
謝謝 -Rob
你添加到您的Gemfile和運行命令行中的「bundle install」? – johnmcaliley 2010-11-15 05:25:07
是的,我確實添加了「gem'thumbs_up'」到我的Gemfile並運行「軟件包安裝」。 – 2010-11-15 05:43:36