Class: Bosh::Director::Models::OrphanDisk
- Defined in:
- lib/bosh/director/models/orphan_disk.rb
Instance Method Summary collapse
- #before_create ⇒ Object
- #cloud_properties ⇒ Object
- #cloud_properties=(cloud_properties) ⇒ Object
- #validate ⇒ Object
Instance Method Details
#before_create ⇒ Object
10 11 12 |
# File 'lib/bosh/director/models/orphan_disk.rb', line 10 def before_create self.created_at ||= Time.now end |
#cloud_properties ⇒ Object
14 15 16 17 |
# File 'lib/bosh/director/models/orphan_disk.rb', line 14 def cloud_properties result = self.cloud_properties_json result ? JSON.parse(result) : {} end |
#cloud_properties=(cloud_properties) ⇒ Object
19 20 21 |
# File 'lib/bosh/director/models/orphan_disk.rb', line 19 def cloud_properties=(cloud_properties) self.cloud_properties_json = JSON.generate(cloud_properties) end |
#validate ⇒ Object
5 6 7 8 |
# File 'lib/bosh/director/models/orphan_disk.rb', line 5 def validate validates_presence [:disk_cid, :deployment_name, :instance_name] validates_unique [:disk_cid] end |