mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
28 lines
696 B
Ruby
28 lines
696 B
Ruby
|
require "rails/railtie"
|
||
|
|
||
|
module ActiveStorage
|
||
|
class Railtie < Rails::Railtie # :nodoc:
|
||
|
config.active_storage = ActiveSupport::OrderedOptions.new
|
||
|
|
||
|
config.eager_load_namespaces << ActiveStorage
|
||
|
|
||
|
initializer "active_storage.routes" do
|
||
|
require "active_storage/disk_controller"
|
||
|
|
||
|
config.after_initialize do |app|
|
||
|
app.routes.prepend do
|
||
|
get "/rails/blobs/:encoded_key" => "active_storage/disk#show", as: :rails_disk_blob
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
initializer "active_storage.attached" do
|
||
|
require "active_storage/attached"
|
||
|
|
||
|
ActiveSupport.on_load(:active_record) do
|
||
|
extend ActiveStorage::Attached::Macros
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|