Module: TwoFaced::ModelExtensions::ClassMethods

Defined in:
lib/two_faced/model_extensions.rb

Instance Method Summary collapse

Instance Method Details

#contextObject



17
18
19
# File 'lib/two_faced/model_extensions.rb', line 17

def context
  @context
end

#for_context(context, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/two_faced/model_extensions.rb', line 29

def for_context(context, options = {})
  options = {
    :attribute_prefix => "overridden",
    :overwrite => false
  }.merge(options)

  @context = context
  includes(:overrides)
  @overwrite_attributes = options[:overwrite]
  @overwrite_attribute_prefix = options[:attribute_prefix]
  self
end

#overwrite_attribute_prefixObject



21
22
23
# File 'lib/two_faced/model_extensions.rb', line 21

def overwrite_attribute_prefix
  @overwrite_attribute_prefix
end

#overwrite_attributes?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/two_faced/model_extensions.rb', line 25

def overwrite_attributes?
  @overwrite_attributes
end