Skip to content

Instantly share code, notes, and snippets.

@jhsu
Created November 13, 2009 01:50
Show Gist options
  • Save jhsu/233513 to your computer and use it in GitHub Desktop.
Save jhsu/233513 to your computer and use it in GitHub Desktop.
Easy Paritals Sinatra
# from: http://smellsblue.blogspot.com/2009/11/easy-partials-in-rails.html
helpers do
def method_missing(method_name, *args, &block)
method_str = method_name.to_s
if method_str =~ /^_.+$/
options = {}
options.merge!(args.first) unless args.empty?
haml method_name, locals => options, :layout => false
else
super
end
end
end
%div
%h2= user.name
%h1 Hello
= _profile, :user => @user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment