Sha256: d59a46806140df92feea141b8a7955ae813adde97f83c0d767b7b2440a0c093c

Contents?: true

Size: 1018 Bytes

Versions: 4

Compression:

Stored size: 1018 Bytes

Contents

module Locomotive
  module Api
    class SitesController < BaseController

      load_and_authorize_resource :class => Locomotive::Site

      # FIXME: the auto-loaded site won't pass authorization for show, update, or destroy
      skip_load_and_authorize_resource :only => [ :show, :update, :destroy ]

      def index
        @sites = Locomotive::Site.all
        respond_with(@sites)
      end

      def show
        @site = Locomotive::Site.find(params[:id])
        authorize! :show, @site
        respond_with(@site)
      end

      def create
        @site = Locomotive::Site.create(params[:site])
        respond_with(@site)
      end

      def update
        @site = Locomotive::Site.find(params[:id])
        authorize! :update, @site
        @site.update_attributes(params[:site])
        respond_with @site
      end

      def destroy
        @site = Locomotive::Site.find(params[:id])
        authorize! :destroy, @site
        @site.destroy
        respond_with @site
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc11 app/controllers/locomotive/api/sites_controller.rb
locomotive_cms-2.0.0.rc10 app/controllers/locomotive/api/sites_controller.rb
locomotive_cms-2.0.0.rc9 app/controllers/locomotive/api/sites_controller.rb
locomotive_cms-2.0.0.rc8 app/controllers/locomotive/api/sites_controller.rb