V
V
vadimstroganov2015-07-25 08:43:29
Ruby on Rails
vadimstroganov, 2015-07-25 08:43:29

Does it make sense to use the content_tag helper?

Hello! I asked myself the question, why is it needed at all and how to do it right.
I can write

content_tag : div, @page.content, class => 'content'

And I can immediately
<div class='content'><%= @page.content %></div>
Actually the question is, what is better to use when writing such structures?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Ivanov, 2015-07-25
@Fly3110

Depending on where the design is written. In view, you can also use a regular tag, but in a helper, content_tag and tag are more convenient

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question