Permalink
Browse files

Add orders association for Spree.user_class models

  • Loading branch information...
1 parent 6106401 commit f090c83831940e9c2fa24049c847cc7ab20893a6 @radar radar committed May 30, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 core/config/initializers/user_class_extensions.rb
@@ -7,6 +7,8 @@
:foreign_key => "user_id",
:class_name => "Spree::Role"
+ has_many :spree_orders, :foreign_key => "user_id", :class_name => "Spree::Order"
+
# 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.any? { |role| role.name == role_in_question.to_s }

0 comments on commit f090c83

Please sign in to comment.