我正在学习轨道4.1.5
我收到这个错误:
2.1.1 :008 > Article NameError: uninitialized constant Article::ImageUploader from /Volumes/disk0s4/www/rails/blog/app/models/article.rb:4:in `<class:Article>' from /Volumes/disk0s4/www/rails/blog/app/models/article.rb:1:in `<top (required)>' from (irb):8 from /Users/didin/.rvm/gems/ruby-2.1.1/gems/railties-4.1.5/lib/rails/commands/console.rb:90:in `start' from /Users/didin/.rvm/gems/ruby-2.1.1/gems/railties-4.1.5/lib/rails/commands/console.rb:9:in `start' from /Users/didin/.rvm/gems/ruby-2.1.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:69:in `console' from /Users/didin/.rvm/gems/ruby-2.1.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!' from /Users/didin/.rvm/gems/ruby-2.1.1/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>' from /Volumes/disk0s4/www/rails/blog/bin/rails:8:in `<top (required)>' from /Users/didin/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /Users/didin/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' from -e:1:in `<main>'
我的文件:article.rb
class Article < ActiveRecord::Base validates_presence_of :title,:body belongs_to :user mount_uploader :image,ImageUploader end
运行rails控制台时出错
当我在控制台上写一个词“文章”时,它会引发上面的错误,但是当这行line_rloader:image,Image.load的文件删除时,它工作正常.
当该行被恢复时,错误再次出现.所以似乎错误是造成这一行,但我不确定.
任何人都可以解决这个问题,请…
谢谢你的阅读和回答:-)