Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Correct name of roles association in config/initializers/user_class_e…

…xtensions
  • Loading branch information...
commit b4c05ed3203846360f56fc7a19600709e9a49502 1 parent ebd53cc
@radar radar authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 core/config/initializers/user_class_extensions.rb
View
7 core/config/initializers/user_class_extensions.rb
@@ -2,11 +2,14 @@
if Spree.user_class
Spree.user_class.class_eval do
include Spree::Core::UserBanners
- has_and_belongs_to_many :roles, :join_table => 'spree_roles_users', :foreign_key => "user_id"
+ has_and_belongs_to_many :spree_roles,
+ :join_table => 'spree_roles_users',
+ :foreign_key => "user_id",
+ :class_name => "Spree::Role"
# 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)
- roles.any? { |role| role.name == role_in_question.to_s }
+ spree_roles.any? { |role| role.name == role_in_question.to_s }
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.