Sha256: 3e9d794fbb1b88d780b21a660a27775a0f37ca4442eba0640f66ef7db720b5c1

Contents?: true

Size: 553 Bytes

Versions: 14

Compression:

Stored size: 553 Bytes

Contents

module Rivendell::Import::Tasking
  module Destination

    def destination
      read_attribute(:destination) or
        write_attribute(:destination, calculate_destination)
    end

    def reset_destination!
      write_attribute :destination, nil
    end

    def self.included(base)
      base.class_eval do
        before_save :destination, :on => :create
      end
    end

    def calculate_destination
      if cart.number
        "Cart #{cart.number}"
      elsif cart.group
        "Cart in group #{cart.group}" 
      end
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rivendell-import-1.04 lib/rivendell/import/tasking/destination.rb
rivendell-import-1.03 lib/rivendell/import/tasking/destination.rb
rivendell-import-1.02 lib/rivendell/import/tasking/destination.rb
rivendell-import-1.01 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.10 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.9 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.8 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.7 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.6 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.0.5 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.0.4 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.0.3 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.0.2 lib/rivendell/import/tasking/destination.rb
rivendell-import-0.0.1 lib/rivendell/import/tasking/destination.rb