lib/bitroles.rb in bitroles-0.2.0 vs lib/bitroles.rb in bitroles-0.2.1
- old
+ new
@@ -37,17 +37,17 @@
roles.each do |role|
class_eval <<-EVAL, __FILE__, __LINE__
scope :#{role.pluralize}, -> { where(['#{roles_mask} & ? > 0', 2**#{roles}.index('#{role}')]) }
def is_#{role}?
- role? role
+ role? '#{role}'
end
def #{role}=(val)
if val
- self.roles += [#{role}] unless has_role? #{role}
+ self.roles += ['#{role}'] unless is_#{role}?
else
- self.roles -= [#{role}] if has_role? #{role}
+ self.roles -= ['#{role}'] if is_#{role}?
end
end
EVAL
end
end