Reputation: 83
I would like to use Active Storage to handle files in my Rails Engine. Typically i would start by creating a migration through the active_storage generator, but the task doesn't appear to exist.
bundle exec rails active_storage:install --trace
** Invoke load_app (first_time)
** Execute load_app
rails aborted!
Don't know how to build task 'active_storage:install' (see --tasks)
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.1/lib/rake/task_manager.rb:59:in `[]'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.1/lib/rake/application.rb:159:in `invoke_task'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.1/lib/rails/command.rb:48:in `invoke'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.1/lib/rails/commands.rb:18:in `<top (required)>'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.1/lib/rails/engine/commands.rb:9:in `require'
/Users/lorenzo/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/railties-5.2.1/lib/rails/engine/commands.rb:9:in `<top (required)>'
bin/rails:14:in `require'
bin/rails:14:in `<main>
I'm not very experienced with engines, so i'm wondering if i'm on the wrong path or not.
Rails 5.2.1 https://github.com/BindaCMS/binda
Upvotes: 0
Views: 931
Reputation: 1068
There is a rails tasks
$ bin/rails app:active_storage:install
It generates the migration that will create 2 tables active_storage_blobs
and active_storage_attachments
. It does exact same thing when result as you will do bin/rails active_storage:install
in the main app.
Hope this help.
Upvotes: 4
Reputation: 18504
Engines are supposed to be mounted inside parent app, which in turn can already use ActiveStorage. If it does not - anyway it's where that migration belongs, you can document that your engine requires activestorage
Upvotes: 0