Created
January 31, 2011 03:12
-
-
Save audionerd/803580 to your computer and use it in GitHub Desktop.
How to override Jammit's default routes (useful if you really want dots in your javascript filenames)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'action_controller' | |
require 'jammit' | |
require 'jammit/controller' | |
Jammit::Controller.class_eval do | |
def before_parse_request | |
case params[:package] + '.' + params[:extension] | |
when 'namespace.module.js' | |
params[:package] = 'namespace.module' | |
params[:extension] = 'js' | |
end | |
end | |
def parse_request_with_extensions | |
before_parse_request | |
parse_request_without_extensions | |
end | |
alias_method_chain :parse_request, :extensions | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment