我在heroku上的应用程序不会更改模型文件app / model / photo.rb

时间:2016-05-13 20:15:21

标签: ruby-on-rails ruby postgresql heroku model

我现在在heroku上部署我的应用程序,发现了一个奇怪的错误。我没有使用旧的更新服务器模型或somwaye(昨天有其他规则)

class Photo < ActiveRecord::Base

      dragonfly_accessor :image do

       after_assign do |img|
        img.encode!('jpg', '-quality 80') if img.image?
       end

    end

    if defined?(ActiveRecord::Base)
      ActiveRecord::Base.extend Dragonfly::Model
      ActiveRecord::Base.extend Dragonfly::Model::Validations
    end


    validates :title, presence: true, length: {minimum: 2, maximum: 20}
    validates :image, presence: true

    validates :image, presence: true
    validates_size_of :image, maximum: 500.kilobytes,
                      message: "should be no more than 500 KB", if: :image_changed?

    validates_property :format, of: :image, in: [:jpeg, :jpg, :png, :bmp], case_sensitive: false,
                       message: "should be either .jpeg, .jpg, .png, .bmp", if: :image_changed?



    end

并使用旧文件

=begin
after_assign do |img|
img.rotate!(90) # 90 is the amount of degrees to rotate
end
=end

#validates_property :width, of: :image, in: (0..400),
message: proc{ |actual, model| "Unlucky #{model.title} - was #{actual}" }

并且没有看到评论

PS。抱歉,我使用翻译谷歌...

0 个答案:

没有答案