lib/avo/app.rb in avo-1.18.2.pre.0 vs lib/avo/app.rb in avo-1.18.2
- old
+ new
@@ -30,11 +30,15 @@
self.license = Licensing::LicenseManager.new(Licensing::HQ.new(request).response).license
# Set the current host for ActiveStorage
begin
- ActiveStorage::Current.url_options = request.base_url
+ if Rails::VERSION::MAJOR === 6
+ ActiveStorage::Current.host = request.base_url
+ elsif Rails::VERSION::MAJOR === 7
+ ActiveStorage::Current.url_options = request.base_url
+ end
rescue => exception
Rails.logger.debug "[Avo] Failed to set ActiveStorage::Current.url_options, #{exception.inspect}"
end
init_resources
@@ -119,12 +123,12 @@
name.to_s.camelize.singularize
end
def get_available_resources(user = nil)
resources.select do |resource|
- Services::AuthorizationService.authorize user, resource.model_class, Avo.configuration.authorization_methods.stringify_keys["index"], raise_exception: false
- end
+ Services::AuthorizationService.authorize user, resource.model_class, Avo.configuration.authorization_methods.stringify_keys["index"], raise_exception: false
+ end
.sort_by { |r| r.name }
end
def resources_navigation(user = nil)
get_available_resources(user).select do |resource|
@@ -143,10 +147,10 @@
end
.map do |filename|
# remove the leading underscore (_)
filename[0] = ""
# remove the extension
- filename.gsub!('.html.erb', '')
+ filename.gsub!(".html.erb", "")
filename
end
end
def draw_routes