Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/cantango/users/macros.rb,
lib/cantango/permits/macros.rb
Instance Method Summary collapse
- #masquerader ⇒ Object
- #tango_permit(options = {}) ⇒ Object
- #tango_user(options = {}) ⇒ Object (also: #cantango_user)
- #tango_user_account(options = {}) ⇒ Object (also: #tango_account, #cantango_account)
Instance Method Details
#masquerader ⇒ Object
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 = {} name_from_class_name = CanTango::Permit.first_name self.to_s.split("::").last name = [:name] || name_from_class_name account_from_class_name = CanTango::Permit.first_name self.to_s.split("::").first if (self.to_s.split("::").size > 1) account = [:account] || account_from_class_name type = [: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, account # return hash for debugging {:name => name, :type => type, :account => 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 = {} self.send :include, CanTango::Users::User self.send :include, CanTango::Users::Masquerade if [: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 tango_user_account = {} self.send :include, CanTango::Users::UserAccount self.send :include, CanTango::Users::Masquerade if [:masquerade] end |