diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
| commit | 9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch) | |
| tree | 8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /vendor/plugins/paperclip/generators | |
| parent | 85a01e35274b8d4d4165a7b26bd7986e211246bb (diff) | |
| parent | 1853082fcd8c067390c246f9daa01a9b47387497 (diff) | |
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'vendor/plugins/paperclip/generators')
3 files changed, 0 insertions, 51 deletions
diff --git a/vendor/plugins/paperclip/generators/paperclip/USAGE b/vendor/plugins/paperclip/generators/paperclip/USAGE deleted file mode 100644 index 2d611d7d..00000000 --- a/vendor/plugins/paperclip/generators/paperclip/USAGE +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | Usage: | ||
| 2 | |||
| 3 | script/generate paperclip Class attachment1 (attachment2 ...) | ||
| 4 | |||
| 5 | This will create a migration that will add the proper columns to your class's table. \ No newline at end of file | ||
diff --git a/vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb b/vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb deleted file mode 100644 index 77ee5a21..00000000 --- a/vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | class PaperclipGenerator < Rails::Generator::NamedBase | ||
| 2 | attr_accessor :attachments, :migration_name | ||
| 3 | |||
| 4 | def initialize(args, options = {}) | ||
| 5 | super | ||
| 6 | @class_name, @attachments = args[0], args[1..-1] | ||
| 7 | end | ||
| 8 | |||
| 9 | def manifest | ||
| 10 | file_name = generate_file_name | ||
| 11 | @migration_name = file_name.camelize | ||
| 12 | record do |m| | ||
| 13 | m.migration_template "paperclip_migration.rb.erb", | ||
| 14 | File.join('db', 'migrate'), | ||
| 15 | :migration_file_name => file_name | ||
| 16 | end | ||
| 17 | end | ||
| 18 | |||
| 19 | private | ||
| 20 | |||
| 21 | def generate_file_name | ||
| 22 | names = attachments.map{|a| a.underscore } | ||
| 23 | names = names[0..-2] + ["and", names[-1]] if names.length > 1 | ||
| 24 | "add_attachments_#{names.join("_")}_to_#{@class_name.underscore}" | ||
| 25 | end | ||
| 26 | |||
| 27 | end | ||
diff --git a/vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb b/vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb deleted file mode 100644 index eebb0e50..00000000 --- a/vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | class <%= migration_name %> < ActiveRecord::Migration | ||
| 2 | def self.up | ||
| 3 | <% attachments.each do |attachment| -%> | ||
| 4 | add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name, :string | ||
| 5 | add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type, :string | ||
| 6 | add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size, :integer | ||
| 7 | add_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at, :datetime | ||
| 8 | <% end -%> | ||
| 9 | end | ||
| 10 | |||
| 11 | def self.down | ||
| 12 | <% attachments.each do |attachment| -%> | ||
| 13 | remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_name | ||
| 14 | remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_content_type | ||
| 15 | remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_file_size | ||
| 16 | remove_column :<%= class_name.underscore.camelize.tableize %>, :<%= attachment %>_updated_at | ||
| 17 | <% end -%> | ||
| 18 | end | ||
| 19 | end | ||
