Created
March 24, 2009 12:28
-
-
Save hidenowt/84061 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Migration para adicionar as colunas do paperclip no model. | |
class AddAvatarColumnsToUser < 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 | |
add_column :users, :avatar_updated_at, :datetime | |
end | |
def self.down | |
remove_column :users, :avatar_file_name | |
remove_column :users, :avatar_content_type | |
remove_column :users, :avatar_file_size | |
remove_column :users, :avatar_updated_at | |
end | |
end | |
# Ou podemos simplesmente digitar um comando no promt shell. | |
$ ruby script/generate paperclip user avatar | |
# Rode depois o seguinte comando. | |
$ rake db:migrate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment