Created
April 30, 2012 11:06
-
-
Save tallica/2557401 to your computer and use it in GitHub Desktop.
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
def add_route | |
path = name | |
opts = route_options | |
Rails.application.routes.disable_clear_and_finalize = true | |
Rails.application.routes.draw do | |
get path, opts | |
end | |
Rails.application.routes.finalize! | |
Rails.application.routes.disable_clear_and_finalize = false | |
end | |
def route_options | |
@route_options ||= { controller: navigable.controller, | |
action: navigable.action, | |
navigable_id: navigable_id, | |
slug_id: id } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment