Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove obsolete generator

  • Loading branch information...
commit a2a4c7a1355c758dff2012d13cb1d2df6b4bc73d 1 parent d081085
@sikachu sikachu authored
View
5 generators/paperclip/USAGE
@@ -1,5 +0,0 @@
-Usage:
-
- script/generate paperclip Class attachment1 (attachment2 ...)
-
-This will create a migration that will add the proper columns to your class's table.
View
27 generators/paperclip/paperclip_generator.rb
@@ -1,27 +0,0 @@
-class PaperclipGenerator < Rails::Generator::NamedBase
- attr_accessor :attachments, :migration_name
-
- def initialize(args, options = {})
- super
- @class_name, @attachments = args[0], args[1..-1]
- end
-
- def manifest
- file_name = generate_file_name
- @migration_name = file_name.camelize
- record do |m|
- m.migration_template "paperclip_migration.rb.erb",
- File.join('db', 'migrate'),
- :migration_file_name => file_name
- end
- end
-
- private
-
- def generate_file_name
- names = attachments.map{|a| a.underscore }
- names = names[0..-2] + ["and", names[-1]] if names.length > 1
- "add_attachments_#{names.join("_")}_to_#{@class_name.underscore}"
- end
-
-end
View
19 generators/paperclip/templates/paperclip_migration.rb.erb
@@ -1,19 +0,0 @@
-class <%= migration_name %> < ActiveRecord::Migration
- def self.up
-<% attachments.each do |attachment| -%>
- add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string
- add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string
- add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer
- add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime
-<% end -%>
- end
-
- def self.down
-<% attachments.each do |attachment| -%>
- remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name
- remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type
- remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size
- remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at
-<% end -%>
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.