jz
Joined 18 years ago
Karma
248
Submissions
48
Member since
Jan 10
Joined 18 years ago
require 'action_controller/integration'
app = ActionController::Integration::Session.new
module CurrentUserHack
def current_user
@user ||= User.look_up_my_user_here
end
end
ApplicationController.send :include, CurrentUserHack
Now you can make authenticated requests in rake tasks and presumably in script/runner.Can you give an example of how this would hurt the economy?
EDIT - those that down voted, mind giving a reason?
In all fairness, the guy was being a dick (no pun intended) to Zed. However, Zed should have kept the insults to the troll and left Github, Powerset, Engine Yard, and the Ruby community out.
This is an interesting point which I agree with and is usually where I end up. In the past I've started from the opposite end, creating multiple modules, class hierarchies, etc. This future proofing has made things harder for me to follow/understand when reading at a later date. It has become tiresome and now I consciously start at the other end, making the simplest thing that could work. Layers of abstraction then come naturally as needed.