Last active
December 13, 2015 23:19
-
-
Save micahgodbolt/4991146 to your computer and use it in GitHub Desktop.
Partial specific variables using get-serve
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
# Block syntax | |
<% | |
if !defined? title | |
title = "Default Title" | |
end | |
%> | |
<h2><%= title %></h2> | |
<p>Blah blah blah blah</p> | |
# Calling your partials | |
<%= render "/partials/block", :locals => { :title => "Past Events" } %> | |
<%= render "/partials/block", :locals => { :title => "Upcoming Events" } %> |
Huh. I haven't used Serve, but I have used Sinatra on a lot of projects. I use sinatra-partial which gives me a partial
method, which is what my example was based on.
Glad I could help. Ruby is awesome. It's a breath of fresh air after 10 years of PHP.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh last thing. I think it's render, not partial. Otherwise you can do <%= render :partial => "file/name" %>