forked from thoughtbot/paperclip
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All generators working with Rails 2 and 3. Tested in app for Rails 2 …
…and 3.
- Loading branch information
Jon Yurek
committed
Jun 7, 2010
1 parent
f2ef8c4
commit c334c98
Showing
5 changed files
with
14 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
16 changes: 8 additions & 8 deletions
16
lib/generators/paperclip/templates/paperclip_migration.rb.erb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
class <%= migration_class_name %> < ActiveRecord::Migration | ||
def self.up | ||
<% attachment_names.each do |attachment| -%> | ||
add_column :<%= attachment_class.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string | ||
add_column :<%= attachment_class.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string | ||
add_column :<%= attachment_class.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer | ||
add_column :<%= attachment_class.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime | ||
add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string | ||
add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string | ||
add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer | ||
add_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime | ||
<% end -%> | ||
end | ||
|
||
def self.down | ||
<% attachment_names.each do |attachment| -%> | ||
remove_column :<%= attachment_class.underscore.camelize.tableize %>, :<%= attachment %>_file_name | ||
remove_column :<%= attachment_class.underscore.camelize.tableize %>, :<%= attachment %>_content_type | ||
remove_column :<%= attachment_class.underscore.camelize.tableize %>, :<%= attachment %>_file_size | ||
remove_column :<%= attachment_class.underscore.camelize.tableize %>, :<%= attachment %>_updated_at | ||
remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_name | ||
remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_content_type | ||
remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_file_size | ||
remove_column :<%= name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at | ||
<% end -%> | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
puts "THIS IS THE RAILS/INIT.RB FILE" | ||
require 'paperclip/railtie' | ||
Paperclip::Railtie.insert |