-
-
Save nex3/16322 to your computer and use it in GitHub Desktop.
This file contains 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
# Haml blocks (and ERB blocks, for that matter) don't return their contents as a string. | |
# They append content directly to the template. | |
# Thus, you need to use #capture to get their content. | |
# I'm not sure why this worked with ERB; it's probably just an odd consequence of an implementation detail. | |
# Method | |
def submit(*args, &block) | |
@template.content_tag(:div, :class => "save_actions") do | |
super(*args) + @template.capture(&block) | |
end | |
end | |
# Calling Haml block | |
= f.submit "Sign up" do | |
- if @site.beta_invites? | |
or | |
= link_to "Request a beta invite", new_invite_path | |
### Output | |
or | |
<a href="/invites/new">Request a beta invite</a> | |
<div class="save_actions"><input id="user_submit" name="commit" type="submit" value="Sign up" /></div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment