Gem Paperclip 报 - “undefined method `has_attached_file` for” - Ruby on Rails

gazeldx · December 16, 2011 · Last by gazeldx replied at February 04, 2012 · 4404 hits

错误如下,用的是 rails3.1.0 ubuntu。官方的步骤一步也不差,怎么就不认识 rake db:migrate 修改表结构时候怎么就不认识 has_attached_file 呢? $ rake db:migrate == AddAvatarColumnsToUser: migrating ========================================= -- change_table(:users) rake aborted! An error has occurred, this and all later migrations canceled:

undefined method `has_attached_file' for #ActiveRecord::ConnectionAdapters::Table:0xae1d32c

Tasks: TOP => db:migrate (See full trace by running task with --trace)

ImageMagick 已装, Paperclip.options[:command_path] = "/usr/bin/"已加到 config/environments/development.rb, gem "paperclip", "~> 2.4.5"已加。 我还用了 ckediter,它也用到上传了,而且它是用 t.string :avatar_file_name, :null => false t.string :avatar_content_type t.integer :avatar_file_size 这样的方式建表替代 t.has_attached_file

谢谢。

看 ruby-china 用的是 carrierwave,小弟切换过去试试

You need to Sign in before reply, if you don't have an account, please Sign up first.