Sha256: 054a03a79bdaf220df8a3e105f1f8b3e6e85e1f9fd5d8511000eeaf520721412

Contents?: true

Size: 779 Bytes

Versions: 5

Compression:

Stored size: 779 Bytes

Contents

class ShopCustomer < User
  
  include Scoped::Models::User::Scoped
  
  has_many  :orders,    :class_name => 'ShopOrder', :foreign_key => :customer_id
  has_many  :billings,  :through    => :orders
  has_many  :shippings, :through    => :orders
  
  belongs_to  :created_by,  :class_name => 'User'
  belongs_to  :updated_by,  :class_name => 'User'
  
  accepts_nested_attributes_for :orders, :allow_destroy => true
  
  def first_name
    name = ''
    
    names = self.name.split(' ')
    if names.length > 1
      name = names[0, names.length-1].join(' ') 
    else
      name = names.join(' ')
    end
    
    name
  end
  
  def last_name
    name = ''
    
    names = self.name.split(' ')
    if names.length > 1
      name = names[-1]
    end
    
    name
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
radiant-shop-extension-0.11.5 app/models/shop_customer.rb
radiant-shop-extension-0.11.4 app/models/shop_customer.rb
radiant-shop-extension-0.11.3 app/models/shop_customer.rb
radiant-shop-extension-0.11.1 app/models/shop_customer.rb
radiant-shop-extension-0.11.0 app/models/shop_customer.rb