# Few interesting observations

**URL:** <https://www.ruby-forum.com/t/few-interesting-observations/66316>\
**Category:** Engines\
**Created:** [August 24, 2006, 7:16pm UTC](https://www.ruby-forum.com/t/few-interesting-observations/66316 "2006-08-24T19:16:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leveille](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@leveille](https://www.ruby-forum.com/u/leveille)\
**Post date:** [August 24, 2006, 7:16pm UTC](https://www.ruby-forum.com/t/few-interesting-observations/66316/1 "2006-08-24T19:16:38Z")

</div>

So my project is using user and login engines and the docs are not  
100% clear (from newb standpoint) on how to get things rolling. So in  
case anyone else is interested and I might not have it totally right  
(altho it works for me), here’s what I did:

After getting the plugin and engines installed I did the 3 commands  
(no db schema or anything like that - and I’m on rails 1.1.6):

1. rake db:migrate:engines ENGINE=login\_engine
2. rake db:migrate:engines ENGINE=user\_engine
3. rake bootstrap

That set up everything correctly for me. If I did rake -T there  
seemed to be a lot of stuff and just doing ‘rake db:migrate:engines’  
worked correctly for me (altho, checking that rake tasks should give  
me the order…). Anyway, on to my second point, which I know screwed  
up all the above when I tried doing things on another dev machine.

Our project requires email addresses as the login id. When I first  
ran the above on a separate dev machine everything ran fine because I  
had not yet started extending the user object. So when I ran the  
above it was all good. However, once I made a change to the user  
model, checked everything into svn and then tried to set up on a  
second dev machine, I couldn’t get it to work. The following is what  
my extended user model looks like:

This supports email as the login id (thx to Eric for this):

class User \< ActiveRecord::Base  
include LoginEngine::AuthenticatedUser  
include UserEngine::AuthorizedUser

# Hook to use email address as login

before\_validation do |r|  
r.login = r.email  
end

end

This all works fine, but when I started digging thru the  
user\_engine.rake file, I noticed the ‘create\_admin\_user’ task tries  
to find a newly created admin object via the original ‘admin’ login  
id and not the updated email address. So this then cause the task to  
bomb and thusly, when I try to log in, I get endless re-directs; this  
is probably due to some sync issue with the old and new login ids.

Only now at the end of all this (putting two and two together) did I  
figure out that I can config all the initial admin info in my  
environment.rb file. Suppose this is the usual process of trial and  
error. Anyway, I just thought I’d mention these things in case  
someone else was sorta running into some of these issues. Thx for the  
engines as they’ve given me a good jump start on my proj! 🙂

Jason
