happens not adderall in the business of

all lies – less pain to just use current_user and accept the inaccurate naming of the models intent in the instance variable.


fuckin’ fuck, man.

I use restful_acl gem and the restful_auth plugin – restful_auth has generators so that when you create the restful authorization model it will take your class name and fill in the places where it needs to go I have an account model instead of a user model so it filled in all of the instance variables for authenticated user methods with current_account. The restful_acl gem is hardcoded to the current_user instance variable. So I opened the module and method in a file in /lib called restful_acl_controller_hacks.rb so I could alias current_account to current_user.


module RestfulAclController
  module ClassMethods
    def has_permission?
      alias current_user current_account
    end
  end
end

Then I required the file in the application controller:

  require 'restful_acl_controller_hacks'

Now has_permission? works and my specs pass and all is right with the world. For about 2 minutes until I smash into another coding wall due to my lack of experience and inability to remember most things of importance related to OOP.

Posted by jeremy 06/02/2009 at 18h56