Sha256: 8daf2ab082767496a3f3536e5b5b81bf1418ce8c533e80ea2737be2b1b4eeccc

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

module RailsPageComment

  # This module is automatically included into all controllers.
  module ControllerAdditions
    module ClassMethods
      # Sets up a before filter which loads and authorizes the current resource. This performs both
      #
      #   class BooksController < ApplicationController
      #     page_comment_resource
      #   end
      #
      def page_comment_resource(*args)
        page_comment_resource_class.add_after_filter(self, :page_comment_resource, *args)
      end

      def page_comment_resource_class
        ControllerResource
      end


      def notify_changes_class
        RailsPageComment.notify_changes_class_name.to_s.camelize.constantize
      end

    end

    def self.included(base)
      base.extend ClassMethods
    end

  end
end

if defined? ActionController::Base
  ActionController::Base.class_eval do
    include RailsPageComment::ControllerAdditions
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_page_comment-0.1.0 lib/rails_page_comment/controller_additions.rb