even better integration
This commit is contained in:
parent
1ad4694503
commit
ba98341916
@ -1,4 +0,0 @@
|
||||
CarrierWave::Mongoid::Media.routes.draw do
|
||||
get 'media/*path' => 'media#show'
|
||||
end
|
||||
|
@ -1,9 +1,27 @@
|
||||
require 'carrierwave'
|
||||
|
||||
module CarrierWave
|
||||
module Mongoid
|
||||
class Media < ::Rails::Engine
|
||||
initializer 'carrierwave_mongoid_media.carrierwave' do
|
||||
DEFAULT_PREFIX = :media
|
||||
|
||||
class << self
|
||||
attr_writer :prefix
|
||||
end
|
||||
|
||||
def self.prefix
|
||||
@prefix ||= DEFAULT_PREFIX
|
||||
end
|
||||
|
||||
def self.routes(router, prefix = :media)
|
||||
self.prefix = prefix
|
||||
|
||||
CarrierWave.configure do |c|
|
||||
c.grid_fs_access_url = '/media'
|
||||
c.grid_fs_access_url = "/#{prefix}"
|
||||
end
|
||||
|
||||
router.instance_exec do
|
||||
get "#{prefix}/*path" => "media#show", :as => :media
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user