Commit 36e6d074 by jyurek

Added sample migration to the README


git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@455 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
parent 03e325bf
......@@ -12,6 +12,22 @@ In your model:
has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
end
In your migrations:
class AddAvatarColumsToUser < ActiveRecord::Migration
def self.up
add_column :users, :avatar_file_name, :string
add_column :users, :avatar_content_type, :string
add_column :users, :avatar_file_size, :integer
end
def self.down
remove_column :users, :avatar_file_name
remove_column :users, :avatar_content_type
remove_column :users, :avatar_file_size
end
end
In your edit and new views:
<% form_for :user, @user, :url => user_path, :html => { :multipart => true } do |form| %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment