Sha256: 2a032f61c86a65b16318ba99ad60637d960a49e920d8c0230eeaf5ca4e5ebb6d

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 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

1 entries across 1 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc12 app/controllers/locomotive/api/sites_controller.rb