On 21 October 2010 05:18, Sriram Chandrasekaran <[email protected]> wrote: > Im new to Rails, and decided to start of with Rails3. After a lot of > searching ive managed to get a little bit of Authlogic working. I'm able > to register a user, login & logout. > > Now, I would like to add more features, get more of authlogic working. > I'm using Railscast EP 160 as my reference. > > Portions of the code found on the tutorial throw errors: Eg: > > <!-- layouts/_topbar.erb --> > <%= link_to "Login", login_path %> > > and I get the following error message: > > undefined local variable or method `login_path' for > #<#<Class:0x0000000311e8f8>:0x0000000310af38>
You have something missing or wrong in routes.rb. I am not into Rails 3 routing yet so not sure what. Have a look at the Rails Guide on routing at http://guides.rubyonrails.org/ > > To overcome this, ive just used a string. i.e. <%= link_to "Login", > "/UserSessions/new" %> > > Now it seems like i've reached an impasse. When i try to output the > current user with: > > <%= @user.Login %> > > I get an error that im unable to circumvent. Can you please help me? > Thanks :) Please find below the error message, and some of the code. > > undefined method `Login' for nil:NilClass The error is saying that you have tried to call Login on a nil object (of type NilClass, which is what nil is). The problem is therefore that @user is nil. Either you have forgotten to set it up or the code setting it has returned nil. Have you looked at the Rails Guide on debugging? Using ruby-debug you can break into your code and examine variables. Colin -- 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.

