Chris Gunnels wrote:

> def index
>     @oLogin = User.find_by_login(params[:l])
>     if @oLogin.login
>       @sLoggedInName = @oLogin.login + ", you've logged in successfully"
>     else
>       render :controller => 'sessions'
>     end
>   end

Aesthetically, I'd change @oLogin to @user, since User.find... will 
return a User instance. I'd also avoid Hungarian notation and camelCase 
variable names.

I think the actual problem is that your call to render is wrong. I'm 
guessing you want a redirect. You might also want to read up on flash 
for messaging to the user. I'd probably write this method something like 
this:


def index
  @user = User.find_by_login(params[:l])
  if @user
    flash[:notice] = "#[email protected]}, you've logged in successfully"
  else
    redirect_to :controller => 'sessions', :action => 'new'
  end
end

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to