Class: Blogit::ApplicationController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/blogit/application_controller.rb

Overview

Inherits from the application’s controller instead of ActionController::Base

Direct Known Subclasses

CommentsController, PostsController

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) blogit_authenticate(options = {})

Sets a class method to specify a before-filter calling whatever Blogit.configuration.authentication_method is set to Accepts the usual before_filter optionss



12
13
14
# File 'app/controllers/blogit/application_controller.rb', line 12

def self.blogit_authenticate(options ={})
  before_filter blogit_conf.authentication_method, options
end

+ (Object) blogit_conf

A helper method to access the Blogit::configuration at the class level



18
19
20
# File 'app/controllers/blogit/application_controller.rb', line 18

def self.blogit_conf
  Blogit::configuration
end

Instance Method Details

- (Object) blogit_conf

A helper method to access the Blogit::configuration at the controller instance level



24
25
26
# File 'app/controllers/blogit/application_controller.rb', line 24

def blogit_conf
  self.class.blogit_conf
end

- (Object) current_blogger

Returns the currently logged in blogger by calling whatever Blogit.current_blogger_method is set to



30
31
32
# File 'app/controllers/blogit/application_controller.rb', line 30

def current_blogger
  send blogit_conf.current_blogger_method
end

- (Boolean) this_blogger?(post)

Returns true if the current_blogger is the owner of the post

Parameters:

  • post

    An instance of Blogit::Post

Returns:

  • (Boolean)


36
37
38
# File 'app/controllers/blogit/application_controller.rb', line 36

def this_blogger?(post)
  current_blogger == post.blogger
end