Created
August 9, 2014 02:03
-
-
Save mayfer/54dff4e2c250ef1a1282 to your computer and use it in GitHub Desktop.
Rails URL Helpers proof of concept
This file contains hidden or 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
class MuratsController | |
def initialize | |
end | |
def index | |
end | |
def beard | |
end | |
end | |
MuratsController.instance_methods(false).each do |method_name| | |
prefix = MuratsController.name.downcase.chomp('controller') | |
define_method "#{method_name}_url" do | |
"/#{prefix}/#{method_name}" | |
end | |
end | |
puts index_url | |
puts beard_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment