Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Cannot define a global role #33

dirksiemers opened this Issue · 5 comments

2 participants


I´m using ruby 1.9.3 with Rails 3.2.0

user.has_role "admin"
ArgumentError: wrong number of arguments (1 for 3)
    from /Users/dirksiemers/.rvm/gems/ruby-1.9.3-p0@sovido/gems/activerecord-3.2.0/lib/active_record/dynamic_matchers.rb:29:in `find_or_create_by_name_and_resource_type_and_resource_id'
    from /Users/dirksiemers/.rvm/gems/ruby-1.9.3-p0@sovido/gems/rolify-2.2.0/lib/rolify/role.rb:38:in `has_role'

Yes I got the same error when upgrading to Rails 3.2, it's a change in find_or_create_by_* generated methods. I already did a fix in 3.0 branch, I will backport it in 2.x and make a release.


wow! thanks for the fast feedback :)


I put the fix in the master branch, but an issue with rubygems version and Rails 3.2 makes the specs fail on travis-ci (using JRuby or REE). I don't like to release with failing specs so I will wait travis-ci team to fix it first. In the meantime, you'd better use Rails 3.1 or apply the fix yourself (just a one line fix): see c82d4a1; or use master branch.

@EppO EppO was assigned

Ok, travis-ci guys gave me a trick to update the rubygems version when running the specs. But specs are still failing on JRuby because of a bug in JDBC adapter using Rails 3.2, see jruby/activerecord-jdbc-adapter#132
That means Rails 3.2 ORM adapters currently don't support JRuby for the moment

@EppO EppO referenced this issue

Rails 3.2 Support #34


jdbc adapter for activerecord has been fixed. specs are now passing on JRuby.
rolify 2.2.1 was released including the find_or_create_by_* fix

@EppO EppO was unassigned by dirksiemers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.