Skip to content

Instantly share code, notes, and snippets.

@mayfer
Created August 9, 2014 02:03
Show Gist options
  • Save mayfer/54dff4e2c250ef1a1282 to your computer and use it in GitHub Desktop.
Save mayfer/54dff4e2c250ef1a1282 to your computer and use it in GitHub Desktop.
Rails URL Helpers proof of concept
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