SHLG and lib dir

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?



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.


Have you definitely 'require’d your member_system.rb file somewhere?

Ack! I knew it was something simple! thanks so much…


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs