-
added a spec to test the rails generator using ammeter gem
-
Gemfile cleanup, moved all dependencies in gemspec instead
-
edited the dependency to Rails 3.1 and newer, now that Rails 3.1 has been released
-
new role scoping capabilities
-
instance level :
user.has_role "moderator", Forum.first
(already supported in previous release). user has the moderator role only on that Forum in particular -
class level :
user.has_role "moderator", Forum
. User has the moderator role on all instances of Forum -
global level :
user.has_role "moderator"
(already supported in previous release). User has the moderator role globally (e.q. on all resources)
-
-
new scoped query capabilities
-
user.has_role? "moderator", Forum.first
(already supported in previous release). asks if the user has the moderator role on Forum.first instance -
user.has_role? "moderator", Forum
. asks if the user has the moderator role on all Forum instances -
user.has_role? "moderator"
(already supported in previous release). asks if the user has the global moderator role -
user.has_role? "moderator", :any
. asks if the user has at least one moderator role no matter the scope is (instance, class or global).
-
-
added a new parameter to disable dynamic shortcut methods due to potential incompatibility with other gems using method_missing with the same pattern
-
add
Rolify.dynamic_shortcuts = false
in the initializer file or -
use the generator command with a third parameter:
-
rails g rolify:role Role User false
-
-
-
removed the railtie as it created more problems than it solved
-
code refactoring to do some speed improvements and code clean up
-
added a lot of specs to improve tests coverage
-
wrote a tutorial showing how to use rolify with CanCan and Devise
-
rolify is now on travis-ci to monitor build status
-
added a method_missing to catch newly created role outside the current ruby process (i.e. dynamic shortcut methods are not defined within this process)
-
dynamic shortcut is created on the fly in the method_missing to avoid extra method_missing for the same dynamic shortcut
-
check if the role actually exists in the database before defining the new method
-
first call is slower due to method_missing but next calls are fast
-
avoid strange bugs when spawning many ruby processes as the dynamic shortcut methods were only defined in the process that used the
has_role
command
-
-
custom User and Role class names support
-
can now use other class names for Role and User classes
-
fixed generators and templates
-
join table is explicitly set to avoid alphabetical order issue
-
-
created a new railtie to load the dynamic shortcuts at startup
-
fixed a nasty typo on a variable name and added a spec to make it never happen again
-
dynamic shortcuts support
-
creates automatically new methods upon new role creation (or at startup for a Rails app)
-
has_role "admin"
will create a method calledis_admin?
-
has_role "moderator", Forum.first
will create 2 methods:* <tt>is_moderator_of?(resource)</tt> * <tt>is_moderator?</tt>
-
-
removing role support
-
has_no_role
removes a global role or a role scoped to a resource -
Please note that trying to remove a global role whereas the user a role with the same name on a resource will remove that scoped role
-
Trying to remove a role scoped to a resource whereas the user has a global role won’t remove it
-
-
multiple roles check:
-
has_all_roles?
returns true if the user has ALL the roles in arguments -
has_any_role?
returns true if the user has ANY the roles in arguments
-
-
fixed the generator to include the lib
-
fixed the migration file with missing polymorphic field
-
added some examples in documentation
-
first release