Class: Rivendell::Import::Cart::DbUpdater

Inherits:
Updater
  • Object
show all
Defined in:
lib/rivendell/import/cart.rb

Instance Attribute Summary

Attributes inherited from Updater

#cart

Instance Method Summary collapse

Methods inherited from Updater

#empty_title?, #initialize, #title_with_default, #update

Constructor Details

This class inherits a constructor from Rivendell::Import::Cart::Updater

Instance Method Details

#current_cartObject



130
131
132
# File 'lib/rivendell/import/cart.rb', line 130

def current_cart
  @current_cart ||= Rivendell::DB::Cart.get(number)
end

#current_titleObject



134
135
136
# File 'lib/rivendell/import/cart.rb', line 134

def current_title
  current_cart.title
end

#update!Object



138
139
140
141
142
143
144
145
146
147
# File 'lib/rivendell/import/cart.rb', line 138

def update!
  Database.init

  if title_with_default or not scheduler_codes.empty?
    Rivendell::Import.logger.debug "Update Cart by DB"
    current_cart.title = title_with_default if title_with_default
    current_cart.scheduler_codes = scheduler_codes unless scheduler_codes.empty?
    current_cart.save
  end
end