Skip to content

Files

Latest commit

 

History

History
33 lines (24 loc) · 659 Bytes

Rails-RenderInline.md

File metadata and controls

33 lines (24 loc) · 659 Bytes

Pattern: Use of inline rendering

Issue: -

Description

This rule looks for inline rendering within controller actions.

Examples

# bad
class ProductsController < ApplicationController
  def index
    render inline: "<% products.each do |p| %><p><%= p.name %></p><% end %>", type: :erb
  end
end

# good
# app/views/products/index.html.erb
# <% products.each do |p| %>
#   <p><%= p.name %></p>
# <% end %>

class ProductsController < ApplicationController
  def index
  end
end

Further Reading