Skip to content

Instantly share code, notes, and snippets.

@royzinn
Created November 6, 2015 06:44
Show Gist options
  • Save royzinn/7e3b6d01113ce6d8ebb3 to your computer and use it in GitHub Desktop.
Save royzinn/7e3b6d01113ce6d8ebb3 to your computer and use it in GitHub Desktop.
content + partial
# Controller( UsersController ):
def do_something
@some_var = some_value
@some_other_var = some_other_value
# additional controller logic
render :do_something # this is not required if the view has the same name (i.e., app/views/users/do_something.html.erb)
end
# in the view (app/views/users/do_something.html.erb)
<%= render partial: partial_name, locals: { local_var_name: @some_var } %>
<h1> Here we put all the other HTML that we want</h1>
<p> .... </p>
<%= render partial: partial_name, locals: { local_var_name: @some_other_var } %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment