Sha256: 089ad49ac6cd3d7058e3c97cbb3f0a776f0ab7b6d499f647df8d3fe43da264ef

Contents?: true

Size: 477 Bytes

Versions: 8

Compression:

Stored size: 477 Bytes

Contents

class Admin::SectionsController < Admin::BaseController
  belongs_to :site

  respond_to :html
  respond_to :json, :only => :update

  before_filter :protect_last_section, :only => :destroy

  helper :sections
  abstract_actions :except => [:index, :destroy]

  purges :destroy

  protected

    def protect_last_section
      if site.sections.count == 1
        resource.errors[:error] = [:last_section_cant_be_destroyed]
        respond_with(resources)
      end
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adva-core-0.0.14 app/controllers/admin/sections_controller.rb
adva-core-0.0.13 app/controllers/admin/sections_controller.rb
adva-core-0.0.9 app/controllers/admin/sections_controller.rb
adva-core-0.0.8 app/controllers/admin/sections_controller.rb
adva-core-0.0.7 app/controllers/admin/sections_controller.rb
adva-core-0.0.6 app/controllers/admin/sections_controller.rb
adva-core-0.0.5 app/controllers/admin/sections_controller.rb
adva-core-0.0.4 app/controllers/admin/sections_controller.rb