Class: ActiveRecord::Associations::AssociationProxy
- Inherits:
-
Object
- Object
- ActiveRecord::Associations::AssociationProxy
- Defined in:
- lib/portable_model/active_record.rb
Instance Method Summary collapse
-
#export_to_yml(filename) ⇒ Object
Export the association to a YAML file.
-
#import_from_yml(filename) ⇒ Object
Import the association from a YAML file.
Instance Method Details
#export_to_yml(filename) ⇒ Object
Export the association to a YAML file.
26 27 28 29 30 31 32 |
# File 'lib/portable_model/active_record.rb', line 26 def export_to_yml(filename) NotPortableError.raise_on_not_portable(self) Pathname.new(filename).open('w') do |out| YAML::dump(export_portable_association, out) end end |
#import_from_yml(filename) ⇒ Object
Import the association from a YAML file.
36 37 38 39 |
# File 'lib/portable_model/active_record.rb', line 36 def import_from_yml(filename) NotPortableError.raise_on_not_portable(self) import_portable_association(YAML::load_file(filename)) end |