【发布时间】:2011-02-14 21:20:36
【问题描述】:
我已经安装了回形针 gem。它正在其他地方使用,所以我知道它正在工作。
我有我的模型,
class Slide < ActiveRecord::Base
has_attached_file :image, :style => {
:large => "1400x786!",
:medium => "128x128>",
:small => "105x90!"
}
end
我创建了我的专栏
class AddImageToSlides < ActiveRecord::Migration
def self.up
add_column :slides, :image_file_name, :string
add_column :slides, :image_content_type, :string
add_column :slides, :image_file_size, :interger
add_column :slides, :image_updated_at, :datetime
end
def self.down
remove_column :slides, :image_file_name
remove_column :slides, :image_content_type
remove_column :slides, :image_file_size
remove_column :slides, :image_updated_at
end
end
我做了耙子,
rake db:migrate
我的表单中有“{ :multipart => true }”
<%= form_for(@slide, :class=>"slidesForm", :html => { :multipart => true }) do |f| %>
我正试图像这样提取图像信息,
<div class="slidesPreview" style="background:url('<%= @slide.image.url(:large) %>') top left no-repeat;">
只有当我使用“@slide.image.url”时它才会起作用,但它只显示原始照片。
我查看了 public/system/images/,它似乎只保存原始/而不是大/、中/或小/。我检查了错误日志,什么也没有。
我刚开始学习 RoR,所以请原谅我的无知。
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 paperclip gem