Skip to content

Instantly share code, notes, and snippets.

@paneq
Created September 22, 2011 11:14
Show Gist options
  • Save paneq/1234553 to your computer and use it in GitHub Desktop.
Save paneq/1234553 to your computer and use it in GitHub Desktop.
skip loading all helper
class SkipAutoloadingAllHelpersController < ActionController::Base
# Fuck you, rails!
def self.helper(*params)
if params.include?(:all)
Rails.logger.warn("Rejected :all")
params.reject!{|p| p == :all}
end
super
end
def self.default_helper_module!
end
clear_helpers # http://stackoverflow.com/questions/1179865/why-are-all-rails-helpers-available-to-all-views-all-the-time-is-there-a-way-to
end
class ApplicationController < SkipAutoloadingAllHelpersController
protect_from_forgery
layout 'application'
helper :application # not loaded automatically because we turned it off
end
module MssHelper
def tabs
[ Tab.new("Absences", mss_absence_path) ]
end
def current_tab
nil
end
end
module Mss::AbsenceHelper
def current_tab
tabs.first
end
end
class Mss::AbsenceController < ApplicationController
helper :mss
helper :"mss/absence"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment