RolifyCommunity / rolify

Role management library with resource scoping
https://rolifycommunity.github.io/rolify/
MIT License
3.16k stars 404 forks source link

Maintain compatibility with 1.9.3 #491

Closed pathway27 closed 6 years ago

pathway27 commented 6 years ago

Hi,

I had an issue with the generator my Rails v3.2, ruby 1.9.3 application. It seems __dir__ is not defined in 1.9.3.

$ rails g rolify Role Login
      invoke  active_record
      create    app/models/role.rb
      invoke    rspec
      create      spec/models/role_spec.rb
/Users/mq20170527/.rvm/gems/ruby-1.9.3-p551/gems/rolify-5.2.0/lib/generators/active_record/rolify_generator.rb:60:in `model_content': undefined local variable or method `__dir__' for #<ActiveRecord::Generators::RolifyGenerator:0x007fefd058d230> (NameError)
    from /Users/mq20170527/.rvm/gems/ruby-1.9.3-p551/gems/rolify-5.2.0/lib/generators/active_record/rolify_generator.rb:34:in `inject_role_class'

This fixes the problem.

wldcordeiro commented 6 years ago

The library is now Ruby 2.2+