views:

760

answers:

4

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?

+1  A: 

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.

srboisvert
Bort looks pretty cool I think I will do that next time around.
Ryan Lanciaux
+2  A: 

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.

Ryan Bigg
+2  A: 

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
erik
+1  A: 

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.

daze