Module: AD::Framework::Patterns::HasSchema::ClassMethods
- Defined in:
- lib/ad-framework/patterns/has_schema.rb
Instance Method Summary collapse
- #after_create(*method_names) ⇒ Object
- #after_destroy(*method_names) ⇒ Object
- #after_save(*method_names) ⇒ Object
- #after_update(*method_names) ⇒ Object
-
#attributes(*attribute_names) ⇒ Object
Attributes methods.
-
#before_create(*method_names) ⇒ Object
Callbacks methods.
- #before_destroy(*method_names) ⇒ Object
- #before_save(*method_names) ⇒ Object
- #before_update(*method_names) ⇒ Object
- #ldap_name(name = nil) ⇒ Object
-
#must_set(*attribute_names) ⇒ Object
Validation methods.
- #rdn(name = nil) ⇒ Object
- #read_attributes(*attribute_names) ⇒ Object
- #schema ⇒ Object
- #treebase(value = nil) ⇒ Object
- #write_attributes(*attribute_names) ⇒ Object
Instance Method Details
#after_create(*method_names) ⇒ Object
104 105 106 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 104 def after_create(*method_names) self.schema.add_callback(:after, :create, method_names) end |
#after_destroy(*method_names) ⇒ Object
117 118 119 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 117 def after_destroy(*method_names) self.schema.add_callback(:after, :destroy, method_names) end |
#after_save(*method_names) ⇒ Object
112 113 114 115 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 112 def after_save(*method_names) self.after_create(*method_names) self.after_update(*method_names) end |
#after_update(*method_names) ⇒ Object
108 109 110 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 108 def after_update(*method_names) self.schema.add_callback(:after, :update, method_names) end |
#attributes(*attribute_names) ⇒ Object
Attributes methods
69 70 71 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 69 def attributes(*attribute_names) self.schema.add_attributes(attribute_names) end |
#before_create(*method_names) ⇒ Object
Callbacks methods
87 88 89 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 87 def before_create(*method_names) self.schema.add_callback(:before, :create, method_names) end |
#before_destroy(*method_names) ⇒ Object
100 101 102 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 100 def before_destroy(*method_names) self.schema.add_callback(:before, :destroy, method_names) end |
#before_save(*method_names) ⇒ Object
95 96 97 98 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 95 def before_save(*method_names) self.before_create(*method_names) self.before_update(*method_names) end |
#before_update(*method_names) ⇒ Object
91 92 93 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 91 def before_update(*method_names) self.schema.add_callback(:before, :update, method_names) end |
#ldap_name(name = nil) ⇒ Object
53 54 55 56 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 53 def ldap_name(name = nil) (self.schema.ldap_name = name) if name self.schema.ldap_name end |
#must_set(*attribute_names) ⇒ Object
Validation methods
82 83 84 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 82 def must_set(*attribute_names) self.schema.add_mandatory(attribute_names) end |
#rdn(name = nil) ⇒ Object
63 64 65 66 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 63 def rdn(name = nil) (self.schema.rdn = name) if name self.schema.rdn end |
#read_attributes(*attribute_names) ⇒ Object
73 74 75 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 73 def read_attributes(*attribute_names) self.schema.add_read_attributes(attribute_names) end |
#schema ⇒ Object
49 50 51 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 49 def schema @schema ||= AD::Framework::Schema.new(self) end |
#treebase(value = nil) ⇒ Object
58 59 60 61 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 58 def treebase(value = nil) (self.schema.treebase = value) if value self.schema.treebase end |
#write_attributes(*attribute_names) ⇒ Object
77 78 79 |
# File 'lib/ad-framework/patterns/has_schema.rb', line 77 def write_attributes(*attribute_names) self.schema.add_write_attributes(attribute_names) end |