rake db:migrate 无法使用回形针
rake db:migrate not working with paperclip
我正在使用 Paperclip,我正在尝试收集我的迁移文件,但出现错误:
SyntaxError: /Users/Brendon/Desktop/savings/app/models/user.rb:5: syntax error, unexpected '{', expecting keyword_end
...attached_file :image, :styles { large: '600x600>', medium: '...
... ^
/Users/Brendon/Desktop/savings/app/models/user.rb:5: syntax error, unexpected ',', expecting keyword_end
...e, :styles { large: '600x600>', medium: '300x300>', thumb: '...
... ^
/Users/Brendon/Desktop/savings/app/models/user.rb:5: syntax error, unexpected ',', expecting keyword_end
...'600x600>', medium: '300x300>', thumb: '150x150#' }
而且我不知道这是怎么回事我的耙子。没有意外的'{'
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
has_attached_file :image, :styles { large: '600x600>', medium: '300x300>', thumb: '150x150#' }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
这是编译器指出的语法错误。
这一行:
has_attached_file :image, :styles { large: '600x600>', medium: '300x300>', thumb: '150x150#' }
应改为:
has_attached_file :image, styles: { large: '600x600>', medium: '300x300>', thumb: '150x150#' }
问题不在于迁移,而是 Paperclip 的语法问题:
has_attached_file :image, styles: {
我正在使用 Paperclip,我正在尝试收集我的迁移文件,但出现错误:
SyntaxError: /Users/Brendon/Desktop/savings/app/models/user.rb:5: syntax error, unexpected '{', expecting keyword_end
...attached_file :image, :styles { large: '600x600>', medium: '...
... ^
/Users/Brendon/Desktop/savings/app/models/user.rb:5: syntax error, unexpected ',', expecting keyword_end
...e, :styles { large: '600x600>', medium: '300x300>', thumb: '...
... ^
/Users/Brendon/Desktop/savings/app/models/user.rb:5: syntax error, unexpected ',', expecting keyword_end
...'600x600>', medium: '300x300>', thumb: '150x150#' }
而且我不知道这是怎么回事我的耙子。没有意外的'{'
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
has_attached_file :image, :styles { large: '600x600>', medium: '300x300>', thumb: '150x150#' }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
这是编译器指出的语法错误。
这一行:
has_attached_file :image, :styles { large: '600x600>', medium: '300x300>', thumb: '150x150#' }
应改为:
has_attached_file :image, styles: { large: '600x600>', medium: '300x300>', thumb: '150x150#' }
问题不在于迁移,而是 Paperclip 的语法问题:
has_attached_file :image, styles: {