Sha256: 96ccca02748c14d5243693cafd275a3f3eda2890c92596ef601a001948382982
Contents?: true
Size: 956 Bytes
Versions: 13
Compression:
Stored size: 956 Bytes
Contents
Spree::Core::Engine.config.to_prepare do if Spree.user_class Spree.user_class.class_eval do include Spree::Core::UserBanners has_and_belongs_to_many :spree_roles, :join_table => 'spree_roles_users', :foreign_key => "user_id", :class_name => "Spree::Role" has_many :spree_orders, :foreign_key => "user_id", :class_name => "Spree::Order" belongs_to :ship_address, :class_name => 'Spree::Address' belongs_to :bill_address, :class_name => 'Spree::Address' # has_spree_role? simply needs to return true or false whether a user has a role or not. def has_spree_role?(role_in_question) spree_roles.where(:name => role_in_question.to_s).any? end def last_incomplete_spree_order spree_orders.incomplete.where(:created_by_id => self.id).order('created_at DESC').first end end end end
Version data entries
13 entries across 13 versions & 1 rubygems