Gift interface added

This commit is contained in:
adam.harbas@a-net.ba
2016-01-11 16:03:53 +01:00
parent 391b912eb2
commit 794cc2ec69
9 changed files with 103 additions and 27 deletions

View File

@@ -1,6 +1,8 @@
class Cart < ActiveRecord::Base
has_many :item_in_carts, -> { order "created_at" }
belongs_to :delivery_destination
belongs_to :delivery_destination, :class_name => 'DeliveryDestination', :foreign_key => 'delivery_destination_id'
belongs_to :delivery_destination, :class_name => 'DeliveryDestination', :foreign_key => 'recipient_destination_id'
def self.find_or_create(anonymous_id, user_id)
cart = nil
@@ -74,7 +76,7 @@ class Cart < ActiveRecord::Base
def title
number = id
name = delivery_destination.name
name = delivery_destination.name
value = Helper.money(total)
phone = "0#{delivery_destination.phone}"
"BR: #{number} za #{name} (#{phone}) - #{value}"

View File

@@ -1,5 +1,5 @@
class DeliveryDestination < ActiveRecord::Base
has_one :cart
has_many :carts
belongs_to :user
def self.create_from_last(anonymous_id, user_id)