1

I am moderately new to Rails so this may be a stupid question...

I followed the basic steps noted on the github site for the plugin (mainly installed the plugin, ran the generator, modified environment.rb and created the UserObserver class in the models directory)

The error I'm getting is saying it's coming from active_support/dependencies. "'load_missing_constant': uninitialized constant UserObserver (NameError)." Any idea on why it could not find the user observer class?

2

4 Answers 4

5

This means it's looking for a constant called "UserObserver" (which generally means it's a class / module). It can't find it because you may not have a file called user_observer.rb, generally located in app/models or app/observers.

3

Did you include both of these lines in your environment.rb file? Assuming user_observer.rb is located in app/observers.

config.load_paths += %W( #{RAILS_ROOT}/app/observers )%
config.active_record.observers = :user_observer
1

I don't know the solution to your particular problem but you could take a look at Bort, which is a skeleton app that already has restful auth setup, and see what they have done that you haven't.

1
  • Bort looks pretty cool I think I will do that next time around. Mar 13, 2009 at 15:34
1

I've encountered this problem before. Here's the solution:

Don't make any changes to the environment and routes files before using the generator. use the generator first; THEN add the...

map.signup '/signup', :controller => 'users', :action => 'new' map.login '/login', :controller => 'sessions', :action => 'new' map.logout '/logout', :controller => 'sessions', :action => 'destroy'

...etc.

that should do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.