Rails 管理员显示:缩略图

Rails admin display :thumb image

我有以下代码:

config/initializers/rails_admin.rb

list do
      field :id        #currentId set in app/views/rails_admin/main/index
      field :year
      field :title
      field :intro
      field :description
      field :confidential
      field :star
      field :image do
        formatted_value do
          bindings[:view].tag(:img, { :src => bindings[:object].image.url(:thumb)}) 
        end
      end
    end

app/models/submission.rb

class Submission < ActiveRecord::Base

  # Image attachment and validations
  has_attached_file :file,
    :url => "/files/:class/:attachment/:id/:style/:basename.:extension",
    :path => ":rails_root/public/files/:class/:attachment/:id/:style/:basename.:extension",
    :styles => { :thumb => "100x100#", :small  => "150x150>", :medium => "200x200" }

  # Validate attachment type
  validates_attachment_content_type :file, :content_type => 'application/pdf'

end

问题:在列表视图中,为什么我没有得到那个 :thumb 图像,而是得到一个非常非常大的图像?我猜斩波程序根本不起作用?

validates_attachment_content_type :file, :content_type => 'application/pdf'

并且您希望调整图像大小我想您再次检查您的模式和实现

关注这个

https://github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation