Module: ASModel::ModelScoping

Included in:
RightsRestriction
Defined in:
backend/app/model/ASModel_scoping.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) included(base)



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

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

- (Object) publish!(setting = true)

Mixins will hook in here to add their own publish actions.



50
51
52
53
54
55
56
57
58
# File 'backend/app/model/ASModel_scoping.rb', line 50

def publish!(setting = true)
  object_graph = self.object_graph

  object_graph.each do |model, ids|
    next unless model.publishable?

    model.handle_publish_flag(ids, setting)
  end
end

- (Object) set_suppressed(val)



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'backend/app/model/ASModel_scoping.rb', line 30

def set_suppressed(val)
  unless self.class.suppressible?
    raise "Suppression not supported for this class: #{self.class.inspect}"
  end

  object_graph = self.object_graph

  object_graph.each do |model, ids_to_change|
    model.handle_suppressed(ids_to_change, val)
  end

  RequestContext.open(:enforce_suppression => false) do
    self.class.fire_update(self.class.to_jsonmodel(self.id), self)
  end

  val
end

- (Object) unpublish!



61
62
63
# File 'backend/app/model/ASModel_scoping.rb', line 61

def unpublish!
  publish!(false)
end

- (Object) uri



24
25
26
27
# File 'backend/app/model/ASModel_scoping.rb', line 24

def uri
  # Bleh!
  self.class.uri_for(self.class.my_jsonmodel.record_type, self.id)
end