# Login Engine, Ruby on Rails and General Questions

**URL:** <https://www.ruby-forum.com/t/login-engine-ruby-on-rails-and-general-questions/75173>\
**Category:** Engines\
**Created:** [November 7, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/login-engine-ruby-on-rails-and-general-questions/75173 "2006-11-07T23:59:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba8739/32.png) [@nark](https://www.ruby-forum.com/u/nark)\
**Post date:** [November 7, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/login-engine-ruby-on-rails-and-general-questions/75173/1 "2006-11-07T23:59:15Z")

</div>

Hi guys, I am new to the forums and to Ruby on Rails as well. I am  
currently working on an application that requires a login form. I am  
using RadRails v 0.7.1 and a MySQL Server 5.0 database. I used the  
Salted Login Engine generator that came with RadRails to generate Login  
code. I also (for testing) generated using the scaffold generator a  
basic application. So far I got the login to work flawlessly where the  
user is able to login and is redirected to the main application.  
However, I had a problem with the following code:

def login  
return if generate\_blank  
@user = User.new(params[:user])  
if session[:user] = User.authenticate(params[:user][:login],  
params[:user][:password])

# session[:user].logged\_in\_at = Time.now

```
  session[:user].save
  flash[:notice] = 'Login successful'
  redirect_to_stored_or_default :controller => 'admin', :action => 

```

‘list’  
else  
@login = params[:user][:login]  
flash.now[:warning] = ‘Login unsuccessful’  
end  
end

The commented out code was generating an error stating that the  
logged\_in\_at method did not exist. Is there really no such method? If  
so, why did the login\_generator generate such code?

I am also trying to another field to the login form, Company name.  
However, I don’t know how to do this. What code am I supposed to modify  
in order to authenticate against company name, user name and password?  
Also, how do I add this into the .rhtml code? I think I need to add  
another field to User.authenticate, but where is this method defined?

If someone can also give me a brief high level overview of how to Ruby  
on Rails works (how the controllers interact with the .rhtml files and  
with the helper files) that would be great. Any help is welcome, thanks.
