app/controllers/concerns/adminpanel/gallery_actions.rb in adminpanel-3.2.1 vs app/controllers/concerns/adminpanel/gallery_actions.rb in adminpanel-3.3.0
- old
+ new
@@ -1,20 +1,21 @@
module Adminpanel
module GalleryActions
extend ActiveSupport::Concern
def add_to_gallery
- image_class = params[:model].constantize
+ image_class = params[:model].camelize.constantize
image = image_class.new(file: params[:file], model_type: params[:parent_object_class])
image.model_id = params[:resource_id] if params[:resource_id]
if image.save
response = {
class: image_class.to_controller_name,
id: image.id,
image_url: image.file_url(:thumb)
}
-
+ p 'jaja'
+ p response
respond_to do |f|
f.json{ render status: :ok, json: response.to_json }
end
end
end