Class: PaperclipGenerator

Inherits:
ActiveRecord::Generators::Base
  • Object
show all
Defined in:
lib/generators/paperclip/paperclip_generator.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) source_root



11
12
13
# File 'lib/generators/paperclip/paperclip_generator.rb', line 11

def self.source_root
  @source_root ||= File.expand_path('../templates', __FILE__)
end

Instance Method Details

- (Object) generate_migration



15
16
17
# File 'lib/generators/paperclip/paperclip_generator.rb', line 15

def generate_migration
  migration_template "paperclip_migration.rb.erb", "db/migrate/#{migration_file_name}"
end

- (Object) migration_class_name



27
28
29
# File 'lib/generators/paperclip/paperclip_generator.rb', line 27

def migration_class_name
  migration_name.camelize
end

- (Object) migration_file_name



23
24
25
# File 'lib/generators/paperclip/paperclip_generator.rb', line 23

def migration_file_name
  "#{migration_name}.rb"
end

- (Object) migration_name



19
20
21
# File 'lib/generators/paperclip/paperclip_generator.rb', line 19

def migration_name
  "add_attachment_#{attachment_names.join("_")}_to_#{name.underscore.pluralize}"
end