Skip to content

Instantly share code, notes, and snippets.

@kellysutton
Last active October 31, 2016 04:35
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 kellysutton/970d40a66ecd8b92ecc1990c703d0d54 to your computer and use it in GitHub Desktop.
Save kellysutton/970d40a66ecd8b92ecc1990c703d0d54 to your computer and use it in GitHub Desktop.
strict-templates-examples
class ApplicationController < ActionController::Base
include StrictTemplates::Concern
end
<%# app/views/blogs/show.html.erb %>
<% @blog.posts.each do |post| %>
<%= post.title %><br />
<% end %>
class BlogsController < ApplicationController
def show
@blog = Blog.includes(:posts).find(params[:id])
end
end
class BlogsController < ApplicationController
def show
@blog = Blog.find(params[:id])
end
end
gem 'strict_templates'
SELECT "posts".* FROM "posts" WHERE "posts"."blog_id" = $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment