Commit 7e6b5b6f by Joost Elfering Committed by Jon Yurek

replace t.has_attached_file with t.attachment as the former is deprecated and throws a warning.

parent 5d8a132a
...@@ -2,7 +2,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration
def self.up def self.up
change_table :<%= table_name %> do |t| change_table :<%= table_name %> do |t|
<% attachment_names.each do |attachment| -%> <% attachment_names.each do |attachment| -%>
t.has_attached_file :<%= attachment %> t.attachment :<%= attachment %>
<% end -%> <% end -%>
end end
end end
......
...@@ -20,7 +20,7 @@ class GeneratorTest < Rails::Generators::TestCase ...@@ -20,7 +20,7 @@ class GeneratorTest < Rails::Generators::TestCase
assert_class_method :up, migration do |up| assert_class_method :up, migration do |up|
expected = <<-migration expected = <<-migration
change_table :users do |t| change_table :users do |t|
t.has_attached_file :avatar t.attachment :avatar
end end
migration migration
...@@ -50,8 +50,8 @@ class GeneratorTest < Rails::Generators::TestCase ...@@ -50,8 +50,8 @@ class GeneratorTest < Rails::Generators::TestCase
assert_class_method :up, migration do |up| assert_class_method :up, migration do |up|
expected = <<-migration expected = <<-migration
change_table :users do |t| change_table :users do |t|
t.has_attached_file :avatar t.attachment :avatar
t.has_attached_file :photo t.attachment :photo
end end
migration migration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment