Class: MultipleMan::Identity::SingleField
- Inherits:
-
MultipleMan::Identity
- Object
- MultipleMan::Identity
- MultipleMan::Identity::SingleField
- Defined in:
- lib/multiple_man/identity.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
Returns the value of attribute identifier.
Attributes inherited from MultipleMan::Identity
Instance Method Summary collapse
-
#initialize(record, identifier = :id) ⇒ SingleField
constructor
A new instance of SingleField.
- #value ⇒ Object
Methods inherited from MultipleMan::Identity
Constructor Details
#initialize(record, identifier = :id) ⇒ SingleField
Returns a new instance of SingleField.
32 33 34 35 36 |
# File 'lib/multiple_man/identity.rb', line 32 def initialize(record, identifier = :id) MultipleMan.logger.warn("Using :identifier in publish is deprecated, please switch to identify_by.") self.identifier = identifier || :id super(record) end |
Instance Attribute Details
#identifier ⇒ Object
Returns the value of attribute identifier.
46 47 48 |
# File 'lib/multiple_man/identity.rb', line 46 def identifier @identifier end |
Instance Method Details
#value ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/multiple_man/identity.rb', line 38 def value if identifier.class == Proc identifier.call(record).to_s else record.send(identifier).to_s end end |