Sha256: a567001557c2bdb5a388a0b077c4cec7518327fec2c2f928fb54506f92957313
Contents?: true
Size: 795 Bytes
Versions: 2
Compression:
Stored size: 795 Bytes
Contents
class Module def tango_permit options = {} name_from_class_name = CanTango::Permits::Permit.first_name self.to_s.split("::").last name = options[:name] || name_from_class_name account_from_class_name = CanTango::Permits::Permit.first_name self.to_s.split("::").first if (self.to_s.split("::").size > 1) account = options[:account] || account_from_class_name 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, account # return hash for debugging {:name => name, :type => type, :account => account} end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cantango-0.8.6 | lib/cantango/permits/macros.rb |
cantango-0.8.5.1 | lib/cantango/permits/macros.rb |