Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/cantango/users/macros.rb,
lib/cantango/permits/macros.rb

Instance Method Summary collapse

Instance Method Details

#masqueraderObject



15
16
17
# File 'lib/cantango/users/macros.rb', line 15

def masquerader
  self.send :include, CanTango::Users::Masquerade
end

#tango_permit(options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cantango/permits/macros.rb', line 2

def tango_permit options = {}
  name_from_class_name = CanTango::Permit.first_name self.to_s.split("::").last
  name = options[:name] || name_from_class_name

   = CanTango::Permit.first_name self.to_s.split("::").first if (self.to_s.split("::").size > 1)
   = options[:account] || 

  type = options[:type] || self.superclass.type

  raise "Name of permit could not be determined, try specifying a :name option" if name.nil?
  raise "Type of permit could not be determined, try specifying a :type option" if type.nil?

  CanTango.config.permits.register_permit_class name, self, type, 
  # return hash for debugging
  {:name => name, :type => type, :account => }
end

#tango_user(options = {}) ⇒ Object Also known as: cantango_user



2
3
4
5
# File 'lib/cantango/users/macros.rb', line 2

def tango_user options = {}
  self.send :include, CanTango::Users::User
  self.send :include, CanTango::Users::Masquerade if options[:masquerade]
end

#tango_user_account(options = {}) ⇒ Object Also known as: tango_account, cantango_account



8
9
10
11
# File 'lib/cantango/users/macros.rb', line 8

def  options = {}
  self.send :include, CanTango::Users::UserAccount
  self.send :include, CanTango::Users::Masquerade if options[:masquerade]
end