Today I Learned

A CCSalesPro project TwitterFollow on Twitter

Strict local variables

Rails partials let you do strict local variables with a magic comment:

<%# app/views/customers/_customer.html.erb %>
<%# locals: (customer:) -%>
<%= customer.name %>

If you don't pass a customer to the parital, it will raise an error:

<%= render "customer", not_customer: 42 %>

You must pass the customer:

<%= render "customer", customer: %>