A
A
Arkady Dopokin2015-12-30 16:51:21
Ruby on Rails
Arkady Dopokin, 2015-12-30 16:51:21

What is the difference between "%=%" and "%%" dynamic inserts in Rails (html.erb)?

Good afternoon, I have a question: what is the difference between "<%= %>" and "<% %>" in Ruby on Rails ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
N. Bekseitov, 2015-12-30
@fpd24

The <% %> tags are used to execute Ruby code that doesn't return anything, such as conditions, loops, or blocks, while the <%= %> tags are used when you need the result of execution.

R
Roman Mirilaczvili, 2015-12-30
@2ord

"<% %>" to evaluate expressions
"<%= %>" also, only with output of the evaluated expression to the template, to display

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question