Class: UniversalID::Extensions::ActiveRecordBasePacker
- Inherits:
-
Object
- Object
- UniversalID::Extensions::ActiveRecordBasePacker
- Defined in:
- lib/universalid/extensions/active_record/base_packer.rb
Constant Summary collapse
- HAS_MANY_ASSOCIATIONS =
TODO: implement support for has_one
ActiveRecord::Reflection::HasOneReflection
TODO: implement support for has_and_belongs_to_many
ActiveRecord::Reflection::HasAndBelongsToManyReflection
[ ActiveRecord::Reflection::HasManyReflection ]
- DESCENDANTS_KEY =
"uid:descendants"
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(record) ⇒ ActiveRecordBasePacker
constructor
A new instance of ActiveRecordBasePacker.
- #pack_with(packer) ⇒ Object
- #prepack_database_options ⇒ Object
- #prepack_options ⇒ Object
Constructor Details
#initialize(record) ⇒ ActiveRecordBasePacker
Returns a new instance of ActiveRecordBasePacker.
22 23 24 |
# File 'lib/universalid/extensions/active_record/base_packer.rb', line 22 def initialize(record) @record = record end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
20 21 22 |
# File 'lib/universalid/extensions/active_record/base_packer.rb', line 20 def record @record end |
Instance Method Details
#pack_with(packer) ⇒ Object
26 27 28 29 |
# File 'lib/universalid/extensions/active_record/base_packer.rb', line 26 def pack_with(packer) packer.write record.class.name packer.write packable_attributes end |
#prepack_database_options ⇒ Object
37 38 39 |
# File 'lib/universalid/extensions/active_record/base_packer.rb', line 37 def . end |
#prepack_options ⇒ Object
31 32 33 34 35 |
# File 'lib/universalid/extensions/active_record/base_packer.rb', line 31 def = record.instance_variable_get(:@_uid_prepack_options) = UniversalID::PrepackOptions.new unless .is_a?(UniversalID::PrepackOptions) end |