Skip to content

Instantly share code, notes, and snippets.

@sauberia
Created December 5, 2011 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sauberia/1434138 to your computer and use it in GitHub Desktop.
Save sauberia/1434138 to your computer and use it in GitHub Desktop.
Call localised path method
module ApplicationHelper
def method_missing(meth, *args, &blk)
if (match = meth.to_s.match(/(.+)_path$/)).present?
meth = "#{I18n.locale}_#{meth}"
raise NoMethodError, meth unless respond_to?(meth)
send(meth, *args)
else
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment