Forum: Ruby on Rails SHLG and lib dir

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ben M. (Guest)
on 2006-01-29 02:22
(Received via mailing list)
Slowly figuring out how to get my SaltedHashLoginGenerator stuff
working. The wiki page
says to put "before_filter :login_required" in the user (my "user" is
"member") controller
or in ApplicationController. However, wherever I put it I get

The rest of the SHLG stuff seems to be working... or at least I could
get to the signup
page, register, and confirm my registration from the email it sent. But
the login_required
method -- which is in my member_system.rb ("member" is my "user") --
can't be found.

Hmm, although, I notice that the MemberSystem module has "protected" at
the top... that
means everything below is protected, right? Would that cause a problem?
(that's the way it
was generated though, so I doubt it)

Here's my ApplicationController:

class ApplicationController < ActionController::Base
   include Localization
   include MemberSystem

   helper :member
   model  :member

   before_filter :login_required


And here's some of the lib/member_system.rb:

module MemberSystem



   # login_required filter. add
   #   before_filter :login_required
   # if the controller should be under any rights management.
   # for finer access control you can overwrite
   #   def authorize?(member)
   def login_required

     if not protect?(action_name)
       return true

     if member? and authorize?(@session['member'])
       return true

     # store current location so that we can
     # come back after the user logged in

     # call overwriteable reaction to unauthorized access
     return false


Any ideas?


Ben M. (Guest)
on 2006-01-29 22:14
(Received via mailing list)
Please excuse the ping... allow me to be more terse:

What would cause a method in a module under /lib to not be found?

The method exists and module *is* included in the class that's trying to
call it. The
method is protected, but I just tried it as public and the method still
can't be found.

Any and all ideas very welcome.

James A. (Guest)
on 2006-01-29 23:42
(Received via mailing list)
Have you definitely 'require'd your member_system.rb file somewhere?
Ben M. (Guest)
on 2006-01-30 00:06
(Received via mailing list)
Ack! I knew it was something simple! thanks so much...

This topic is locked and can not be replied to.