Class: Ixtlan::UserManagement::Domain
- Inherits:
-
Object
- Object
- Ixtlan::UserManagement::Domain
- Includes:
- DataMapper::Resource
- Defined in:
- lib/ixtlan/user_management/domain_resource.rb
Constant Summary collapse
- ALL_ID =
1
- DEFAULT_ID =
2
- ALL_NAME =
'ALL'
- DEFAULT_NAME =
'DEFAULT'
Class Method Summary collapse
- .ALL ⇒ Object
- .almost_all(args = {}) ⇒ Object
-
.base_model ⇒ Object
key for selectng the IdentityMap should remain this class if there is no single table inheritance with Discriminator in place i.e.
- .DEFAULT ⇒ Object
- .first_or_create(args) ⇒ Object
- .storage_name(arg) ⇒ Object
Instance Method Summary collapse
- #all? ⇒ Boolean
- #default? ⇒ Boolean
-
#set_timestamps_on_save ⇒ Object
do not record timestamps since they are set from outside.
Class Method Details
.ALL ⇒ Object
44 45 46 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 44 def self.ALL first_or_create( :id => ALL_ID, :name => ALL_NAME ) end |
.almost_all(args = {}) ⇒ Object
52 53 54 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 52 def self.almost_all( args = {} ) all( { :id.gt => ALL_ID }.merge( args ) ) end |
.base_model ⇒ Object
key for selectng the IdentityMap should remain this class if there is no single table inheritance with Discriminator in place i.e. the subclass used as key for the IdentityMap
34 35 36 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 34 def self.base_model self end |
.DEFAULT ⇒ Object
48 49 50 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 48 def self.DEFAULT first_or_create( :id => DEFAULT_ID, :name => DEFAULT_NAME ) end |
.first_or_create(args) ⇒ Object
56 57 58 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 56 def self.first_or_create( args ) first( args ) || create!( args.merge( {:updated_at => DateTime.new( 1 ) } ) ) end |
.storage_name(arg) ⇒ Object
27 28 29 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 27 def self.storage_name(arg) 'ixtlan_domains' end |
Instance Method Details
#all? ⇒ Boolean
69 70 71 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 69 def all? name == ALL_NAME end |
#default? ⇒ Boolean
73 74 75 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 73 def default? name == DEFAULT_NAME end |
#set_timestamps_on_save ⇒ Object
do not record timestamps since they are set from outside
66 67 |
# File 'lib/ixtlan/user_management/domain_resource.rb', line 66 def end |