Login form_tag with select_tag option

Hi all,
In the application i develop, a sophisticated login system is required.
Being a newbie in Ruby, i'm not comfortable with the select tag in the
form tag.
My requirement:
2 tables - User(LoginName, Password, RoleId...) and Role(RoleId,
RoleName...)
View - RoleNames to be loaded in the drop down box and On submit, RoleId
to be passed to controller for authentication.

My Code Snippet:
#Controller
    if request.post? and params[:login]
      @user = User.new(params[:login])
      validUser = User.find(:first,:conditions => ["login_name = ? and
password = ? and role_id = ?",@user.logname, @user.password,
@user.roleid])
      if validUser
        @role = Role.find(:first, :conditions => ["id = ?",
@user.roleid])
        if @role.role_name == "Admin"
          session[:admin] = validUser.id
          redirect_to :controller=>'admins', :action => 'index'
        else
          session[:user] = validUser.id
          redirect_to :controller=>'projects', :action => 'index'
        end
#View
            <label for="user_login">Username:</label>
            <%= text_field("login", "username", :size=>"20" ) %>
            <label for="user_password">Password:</label>
            <%= password_field("login", "password",:size=>"22" ) %>
             <label for="user_login">Role:</label>
      #Here is the issue
            <% @role = Role.find(:all, :select => "role_name") %>
            <%= select_tag("login", options_for_select(@role)) %>
            <%# collection_select(:role, :id, @role, :id, :role_name) %>
            <%= submit_tag "Login" %>

Could anybody please give me a better snippet to accomplish the same...?

Appreciate your prompt reply...

Hi all,
In the application i develop, a sophisticated login system is
required.
Being a newbie in Ruby, i'm not comfortable with the select tag in the
form tag.

Could anybody please give me a better snippet to accomplish the
same...?

have a look at the (still in progress) guide on forms http://guides.rails.info/form_helpers.html

Fred