lib/permissive/permission_definition.rb in permissive-0.2.5.alpha vs lib/permissive/permission_definition.rb in permissive-0.2.6.alpha

- old
+ new

@@ -30,10 +30,12 @@ end def normalize_scope(model, scope) return :global if scope.to_s == 'global' scope = case scope + when ActiveRecord::Base + scope.class.name.to_s.tableize when Class scope.name.tableize when String, Symbol interpolate_scope(model, scope).to_s.tableize else @@ -84,15 +86,13 @@ if model.column_names.include?('role') model.class_eval do def role=(role_name) if role_name self.permissions = self.class.permissions[:global].roles[role_name.to_s.downcase.to_sym] - if respond_to?(:write_attribute) - write_attribute(:role, role_name.to_s.downcase.strip) - end else self.permissions = [] end + write_attribute(:role, role_name.to_s.downcase.strip) end end else model.class_eval do def role=(role_name) \ No newline at end of file