Sha256: 686389a319dc12cad9a0b1e4c3ce2ed4c4447e73f1b04a59e09e19994d0bbc56

Contents?: true

Size: 1.2 KB

Versions: 10

Compression:

Stored size: 1.2 KB

Contents

module Blogit

  # Inherits from the application's controller instead of ActionController::Base
  class ApplicationController < ::ApplicationController
    
    helper :all
    helper_method :current_blogger, :blogit_conf
    
    # Sets a class method to specify a before-filter calling
    # whatever Blogit.configuration.authentication_method is set to
    # Accepts the usual before_filter optionss
    def self.blogit_authenticate(options ={})
      before_filter blogit_conf.authentication_method, options
    end
    
    # A helper method to access the Blogit::configuration
    # at the class level
    def self.blogit_conf
      Blogit::configuration
    end
    
    # A helper method to access the Blogit::configuration
    # at the controller instance level
    def blogit_conf
      self.class.blogit_conf
    end
    
    # Returns the currently logged in blogger by calling
    # whatever Blogit.current_blogger_method is set to
    def current_blogger
      send blogit_conf.current_blogger_method
    end
    
    # Returns true if the current_blogger is the owner of the post
    # @param post An instance of Blogit::Post
    def this_blogger?(post)
      current_blogger == post.blogger
    end
    
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
blogit-0.0.13 app/controllers/blogit/application_controller.rb
blogit-0.0.12 app/controllers/blogit/application_controller.rb
blogit-0.0.11 app/controllers/blogit/application_controller.rb
blogit-0.0.10 app/controllers/blogit/application_controller.rb
blogit-0.0.9 app/controllers/blogit/application_controller.rb
blogit-0.0.8 app/controllers/blogit/application_controller.rb
blogit-0.0.7 app/controllers/blogit/application_controller.rb
blogit-0.0.6 app/controllers/blogit/application_controller.rb
blogit-0.0.5 app/controllers/blogit/application_controller.rb
blogit-0.0.4 app/controllers/blogit/application_controller.rb