Making hooks into Rails controller work properly