Class: Specify::Model::ViewSetObject

Inherits:
Object
  • Object
show all
Defined in:
lib/specify/models/view_set_object.rb

Overview

ViewSetObjects represent Specify user forms (views). The actual views are .views.xml files that are stored as blobs in the database.

Instance Method Summary collapse

Instance Method Details

#before_createObject



21
22
23
24
25
# File 'lib/specify/models/view_set_object.rb', line 21

def before_create
  self.Version = 0
  self.TimestampCreated = Time.now
  super
end

#before_updateObject



27
28
29
30
31
# File 'lib/specify/models/view_set_object.rb', line 27

def before_update
  self.Version += 1
  self.TimestampModified = Time.now
  super
end

#import(file) ⇒ Object

Persists file as a blob the database.



34
35
36
37
38
39
40
# File 'lib/specify/models/view_set_object.rb', line 34

def import(file)
  app_resource_data.import file
  app_resource_dir[:Version] += 1
  app_resource_dir[:TimestampModified] = Time.now
  app_resource_dir.save
  save
end