app/controllers/effective/regions_controller.rb in effective_regions-1.8.0 vs app/controllers/effective/regions_controller.rb in effective_regions-1.8.1
- old
+ new
@@ -12,11 +12,11 @@
end
skip_log_page_views quiet: true, only: [:snippet] if defined?(EffectiveLogging)
def edit
- EffectiveRegions.authorized?(self, :edit, Effective::Region.new())
+ EffectiveRegions.authorize!(self, :edit, Effective::Region.new)
cookies['effective_regions_editting'] = {:value => params[:exit].presence || request.referrer, :path => '/'}
# TODO: turn this into a cookie or something better.
uri = URI.parse(Rack::Utils.unescape(request.url.sub('/edit', '')))
@@ -74,10 +74,10 @@
render :text => 'error', :status => :unprocessable_entity
end
def snippet # This is a GET. CKEDITOR passes us data, we need to render the non-editable content
- EffectiveRegions.authorized?(self, :edit, Effective::Region.new())
+ EffectiveRegions.authorize!(self, :edit, Effective::Region.new)
klass = "Effective::Snippets::#{region_params[:name].try(:classify)}".safe_constantize
if klass.present?
@snippet = klass.new(region_params[:data])