Skip to content

Instantly share code, notes, and snippets.

@mgreenly
Created July 8, 2011 19:27
Show Gist options
  • Select an option

  • Save mgreenly/1072611 to your computer and use it in GitHub Desktop.

Select an option

Save mgreenly/1072611 to your computer and use it in GitHub Desktop.
class Datatable::Base
#....
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
def method_missing(symbol, *args, &block)
if symbol.to_s =~ /(path|url)$/
return Rails.application.routes.url_helpers.send(symbol, *args)
end
super(symbol, *args, &block)
end
#....
end
# which you can then call like so
foo = Datatable::Base.new
foo.link_to(...)
foo.order_path(42)
# etc....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment