Module: ASModel

Defined in:
backend/app/model/ASModel.rb,
backend/app/model/ASModel_crud.rb,
backend/app/model/ASModel_sequel.rb,
backend/app/model/ASModel_scoping.rb,
backend/app/model/ASModel_transfers.rb,
backend/app/model/ASModel_change_tracking.rb,
backend/app/model/ASModel_database_mapping.rb

Defined Under Namespace

Modules: CRUD, ChangeTracking, ClassMethods, DatabaseMapping, ModelScoping, RepositoryTransfers, SequelHooks

Constant Summary collapse

@@all_models =
[]

Class Method Summary collapse

Class Method Details

.all_modelsObject



19
20
21
# File 'backend/app/model/ASModel.rb', line 19

def self.all_models
  @@all_models
end

.included(base) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'backend/app/model/ASModel.rb', line 23

def self.included(base)
  base.instance_eval do
    plugin :optimistic_locking
    plugin :validation_helpers
    plugin :after_initialize
  end

  base.extend(JSONModel)

  base.include(ChangeTracking)
  base.include(CRUD)
  base.include(RepositoryTransfers)
  base.include(DatabaseMapping)
  base.include(SequelHooks)
  base.include(ModelScoping)
  base.include(ObjectGraph)
  base.include(Relationships)

  base.extend(ClassMethods)

  @@all_models << base
end

.update_publish_flag(dataset, val) ⇒ Object



10
11
12
13
# File 'backend/app/model/ASModel_scoping.rb', line 10

def self.update_publish_flag(dataset, val)
  dataset.update(:publish => (val ? 1 : 0),
                 :system_mtime => Time.now)
end

.update_suppressed_flag(dataset, val) ⇒ Object

Code that keeps the records of different repositories isolated and hiding suppressed records.



4
5
6
7
# File 'backend/app/model/ASModel_scoping.rb', line 4

def self.update_suppressed_flag(dataset, val)
  dataset.update(:suppressed => (val ? 1 : 0),
                 :system_mtime => Time.now)
end