Class: Opensteam::Container::Base
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Opensteam::Container::Base
- Defined in:
- lib/opensteam/container.rb
Overview
Container Base Class used for Cart, Orders, Wishlists, etc TODO: check self.abstract == useful
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#copy_items_from(c) ⇒ Object
copy all items from container
c
to current containerself
. -
#move_items_from(c) ⇒ Object
move all items from container
c
to current containerself
.
Class Method Details
.table_name ⇒ Object
27 |
# File 'lib/opensteam/container.rb', line 27 def self.table_name ; "containers" ; end |
Instance Method Details
#copy_items_from(c) ⇒ Object
copy all items from container c
to current container self
47 48 49 50 51 |
# File 'lib/opensteam/container.rb', line 47 def copy_items_from c c.items.each do |v| items.build( v.attributes ) end end |
#move_items_from(c) ⇒ Object
move all items from container c
to current container self
39 40 41 42 43 44 |
# File 'lib/opensteam/container.rb', line 39 def move_items_from c c.items.each do |v| v.update_attribute( :container, self ) end end |