Skip to content

Instantly share code, notes, and snippets.

@hidenowt
Created March 24, 2009 12:28
Show Gist options
  • Save hidenowt/84061 to your computer and use it in GitHub Desktop.
Save hidenowt/84061 to your computer and use it in GitHub Desktop.
# 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