kristianmandrup / roles_mongoid

Roles for mongoid using the Roles generic API from roles_generic
MIT License
29 stars 7 forks source link

Illegal instruction after adding roles_mongoid to Rails 3.0.7, Ruby 1.9.2-p180 #7

Open joe1chen opened 13 years ago

joe1chen commented 13 years ago

I'm developing a Rails 3.0.7 app on OS X 10.6.7 using Ruby 1.9.2-p180. The application is using Devise for authentication. For unknown reason as soon as I add roles_mongoid to the application, the webrick crashes with illegal instruction when the signup url is hit (.e. http://localhost/users/sign_up).

kristianmandrup commented 13 years ago

Please post a stack trace of the error ;)

PS: I have since developed a replacement gem called troles that you might find more useful.

joe1chen commented 13 years ago

Hi Kristian, I would have posted a stack trace if there were a stack trace to post. Unfortunately, I don't see a stack when it crashes, nor do I see any log output. Strangely enough, when I use the Rails console, I am able to create users and assign roles and call all the other role helper methods (i.e. has_role?) without any issues. The problem only arises when I hit the registration page in a browser (http://localhost/users/sign_up).

I am using mongoid with devise 1.4.2, mongoid 2.0.2, ruby 1.9.2-p180, rails 3.0.7. Oddly enough, the same thing (illegal instruction) happens when I switched to your troles gem.

My user.rb looked like this:

class User

include Mongoid::Document include Roles::Mongoid

strategy :role_strings valid_roles_are :admin, :guest, :author, :teacher

...

end

With troles it looked like:

require 'troles' require 'troles/macros'

class User

include Mongoid::Document

troles_strategy(:string_many, :orm => :mongoid, :auto_load => true).configure!

...

end

So it seems like both roles_mongoid as wells as troles both have some common logic that is causing this illegal instruction.

Sorry if I cannot be more specific, as I don't have the time to delve deep into the guts to figure out what's going on.

Joe

On Jul 5, 2011, at 10:56 PM, kristianmandrup wrote:

Please post a stack trace of the error ;)

PS: I have since developed a replacement gem called troles that you might find more useful.

Reply to this email directly or view it on GitHub: https://github.com/kristianmandrup/roles_mongoid/issues/7#issuecomment-1509663