Module: Gluttonberg::Authorizable

Defined in:
lib/gluttonberg/authorizable.rb

Overview

A mixin that will add simple authorization functionality to any arbitrary model. This includes finders for retrieving authorized records and instance methods for quickly changing the state.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

Add the class and instance methods, declare the relationship we store the published state in.



8
9
10
11
12
13
14
15
# File 'lib/gluttonberg/authorizable.rb', line 8

def self.included(klass)
  klass.class_eval do
    extend ClassMethods
    include InstanceMethods
    
    belongs_to :user , :class_name => "Gluttonberg::User"
  end
end