aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-06 13:58:43 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-06 13:58:47 +0200
commit6129a63764a0ac3c81d7876db5d9a55d1c5c963c (patch)
tree4c590405f760a0305e01c6d33b6833baf0ed362e /lib
parent7341d9100985b59d14afb804c71826d6617bba7e (diff)
downloadrails-6129a63764a0ac3c81d7876db5d9a55d1c5c963c.tar.gz
rails-6129a63764a0ac3c81d7876db5d9a55d1c5c963c.tar.bz2
rails-6129a63764a0ac3c81d7876db5d9a55d1c5c963c.zip
Add task to install the migration needed
Diffstat (limited to 'lib')
-rw-r--r--lib/active_storage/railtie.rb2
-rw-r--r--lib/tasks/activestorage.rake12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/active_storage/railtie.rb b/lib/active_storage/railtie.rb
index bf38d5aff5..15ab8aa096 100644
--- a/lib/active_storage/railtie.rb
+++ b/lib/active_storage/railtie.rb
@@ -1,7 +1,7 @@
require "rails/railtie"
module ActiveStorage
- class Railtie < Rails::Railtie # :nodoc:
+ class Engine < Rails::Engine # :nodoc:
config.active_storage = ActiveSupport::OrderedOptions.new
config.eager_load_namespaces << ActiveStorage
diff --git a/lib/tasks/activestorage.rake b/lib/tasks/activestorage.rake
new file mode 100644
index 0000000000..ff44958151
--- /dev/null
+++ b/lib/tasks/activestorage.rake
@@ -0,0 +1,12 @@
+require "fileutils"
+
+namespace :activestorage do
+ desc "Copy over the migration needed to the application"
+ task :migration do
+ FileUtils.cp \
+ File.expand_path("../../active_storage/migration.rb", __FILE__),
+ Rails.root.join("db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_active_storage_create_tables.rb")
+
+ puts "Now run rails db:migrate to create the tables for Active Storage"
+ end
+end