This is my Gig model
这是我的Gig模型
class Gig < ActiveRecord::Base
has_attached_file :image, :styles => { :medium => "360x170>", :bigger => "650x459>" }
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
validate :image_size_validation
def image_size_validation
if image.size > 2.megabytes
errors.add(:base, "Image should be less than 2MB")
end
end
end
class Gig <