Pass local variables to Rails partial in only specific cases
You can pass a local variable to a partial in only specific cases by using
# index.html.haml = render partial: "invoice"
# show.html.haml = render partial: "invoice", with_account: true
%h5 = invoice.description - if local_assigns[:with_account] %p Account ID: = invoice.account_id
Drop your email in the box below to subscribe to my newsletter. Once per week you'll get Ruby/Rails tips, guides, job postings, and general thoughts from the web developer trenches.