small medium large xlarge

11 Feb 2008, 20:26
Rick Lacharite (1 post)

I have been following through on the book using my own model (which differs little from the book model) and I am at iteration F3: Limiting Access. At this point I wanted to apply the RoR authentication plugin and I did manage to get it to work - to a point. This is where I go off the “rails”. I think where the problem lies is in the views/layouts where you have created the file store.rhtml. After installing the authentication system I get the following error - only for store.rhtml for code in the sidebar:` NoMethodError in Store#index

Showing app/views/layouts/store.rhtml where line #21 raised:

undefined method `login’ for :false:Symbol

Extracted source (around line #21):

18: </div> 19: <div id="loginlogout"> 20: <% if current_user %> 21: Logged in as <%= current_user.login %> 22: (<%= link_to “Logout”, :controller => “/account”, :action => “logout” %>) 23: <% else %> 24: <%= link_to “Login”, :controller => “/account”, :action => “login” %> ` All of the controllers inherit the the authentication class but it doesn’t seem to work within the layout directory. I have tried numerous “fixes” but just can’t seem to wrap my head around this one. Here is a list of controllers and their inheritance (if that helps):application.rb class ApplicationController < ActionController::Base; base_controller.rb class BaseController < ApplicationController; AccountController, AdminController and StoreController < BaseController

Can some one provide some help in this area. My gut tells me it is an inheritance problem but I am not sure and don’t know how to fix it.

You must be logged in to comment