Module: CanTango::Macros::Permit
- Extended by:
- Permit::Helper::Naming
- Included in:
- Class
- Defined in:
- lib/cantango/permits_ext/macros/permit.rb
Instance Method Summary collapse
Methods included from Permit::Helper::Naming
account_name, permit_name, permit_type
Instance Method Details
#tango_permit(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cantango/permits_ext/macros/permit.rb', line 9 def tango_permit = {} name = [:name] || CanTango::Macros::Permit.permit_name(self) account = [:account] || CanTango::Macros::Permit.account_name(self) super_class = self.superclass class_type = unless super_class == Object super_class.respond_to?(:type) ? super_class.type : nil end type = [:type] || class_type raise CanTango::Permit::MissingNameError, "Name of permit could not be determined, try specifying a :name option" if name.nil? raise CanTango::Permit::MissingTypeError, "Type of permit could not be determined, try specifying a :type option" if type.nil? = {:name => name, :type => type, :account => account} CanTango.config.permits.register self, end |