Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
2 parents 363959f + e3a1179 commit 383a7e151ae2873bd283b5fe78be58216dc328d6 Ryan Oberholzer committed Sep 6, 2010
Showing with 434 additions and 21 deletions.
  1. +22 −0 CHANGELOG.rdoc
  2. +1 −18 README.rdoc
  3. +2 −2 Rakefile
  4. +12 −1 lib/easy_roles.rb
  5. +332 −0 spec/easy_roles_spec.rb
  6. +65 −0 spec/spec_helper.rb
View
@@ -0,0 +1,22 @@
+=== 06 September 2010 - Version 1.1.0
+Fixed the issue where the is_user? method was not working through association, if the is_user? method had not been called before
+Wrote tests (FINALLY!!!)
+
+=== 05 April 2010 - Version 1.0.0
+Serialize method updated for Rails 3 compatibility. (Thanks to firebelly for pointing this out)
+
+=== 03 February 2010 - Version 0.4.2
+Fixed migration names
+Does not allow duplicates to be added
+
+=== 08 December 2009 - Version 0.4.1
+Added a bitmask migration generator (Read below for usage)
+
+=== 08 December 2009 - Version 0.4.0
+Added the ability to use bitmasks instead of serializing the roles in a table (Read below on how to setup and use)
+
+=== 17 November 2009 - Version 0.3.0
+Added a generator to generate the database columns "script/generate easy_roles Table Column_Name"
+
+=== 21 October 2009 - Version 0.2.0
+Added bang methods for 'add_role' and 'remove_role' which can be accessed through 'add_role!' and 'remove_role!' respectively.
View
@@ -4,24 +4,7 @@ Simple rails gem for basic role authorization with ruby on rails.
== Changelog
-=== 05 April 2010 - Version 1.0.0
-Serialize method updated for Rails 3 compatibility. (Thanks to firebelly for pointing this out)
-
-=== 03 February 2010 - Version 0.4.2
-Fixed migration names
-Does not allow duplicates to be added
-
-=== 08 December 2009 - Version 0.4.1
-Added a bitmask migration generator (Read below for usage)
-
-=== 08 December 2009 - Version 0.4.0
-Added the ability to use bitmasks instead of serializing the roles in a table (Read below on how to setup and use)
-
-=== 17 November 2009 - Version 0.3.0
-Added a generator to generate the database columns "script/generate easy_roles Table Column_Name"
-
-=== 21 October 2009 - Version 0.2.0
-Added bang methods for 'add_role' and 'remove_role' which can be accessed through 'add_role!' and 'remove_role!' respectively.
+Please read the CHANGELOG.rdoc file.
== Install
View
@@ -2,11 +2,11 @@ require 'rubygems'
require 'rake'
require 'echoe'
-Echoe.new('easy_roles', '1.0.0') do |p|
+Echoe.new('easy_roles', '1.1.0') do |p|
p.description = "Easy role authorization in rails"
p.url = "http://github.com/platform45/easy_roles"
p.author = "Platform45"
p.email = "ryan@platform45.com"
p.ignore_pattern = ["tmp/*", "script/*"]
- p.development_dependencies = []
+ p.development_dependencies = ["rspec", "active_record", "sqlite3-ruby"]
end
View
@@ -2,6 +2,7 @@ module EasyRoles
def self.included(base)
base.extend ClassMethods
base.send :alias_method_chain, :method_missing, :roles
+ base.send :alias_method_chain, :respond_to?, :roles
end
module ClassMethods
@@ -113,8 +114,18 @@ def method_missing_with_roles(method_id, *args, &block)
method_missing_without_roles(method_id, *args, &block)
end
end
+
+ def respond_to_with_roles?(method_id, include_private = false)
+ match = method_id.to_s.match(/^is_(\w+)[?]$/)
+ if match && respond_to?('has_role?')
+ true
+ else
+ respond_to_without_roles?(method_id, include_private = false)
+ end
+ end
end
class ActiveRecord::Base
include EasyRoles
-end
+end
+
Oops, something went wrong.

0 comments on commit 383a7e1

Please sign in to comment.