Content_tag inside content_tag

Hi

i tried content_tag inside content_tag bu its not working

<%= content_tag(:h1,“Arrange”+content_tag(:span,“Demo”))%>

i want like this type

Arrange Demo

plz help.

bye

call like this
content_tag(:h1,raw(“Arrange”+(content_tag(:span,“Demo”))))

=> “

ArrangeDemo

kingston.s

On Tue, Aug 13, 2013 at 4:50 AM, kanna [email protected] wrote:

i tried content_tag inside content_tag bu its not working

More readably (IMO):

<%= content_tag :h1 do %>
Arrange <%= content_tag :span, ‘Demo’ %>
<% end %>


Hassan S. ------------------------ [email protected]

twitter: @hassan

kanna wrote in post #1118570:

Hi

i tried content_tag inside content_tag bu its not working

<%= content_tag(:h1,“Arrange”+content_tag(:span,“Demo”))%>

i want like this type

Arrange Demo

More readably (IMO):

<%= content_tag :h1 do %>
Arrange <%= content_tag :span, ‘Demo’ %>
<% end %>

What’s wrong with just using standard HTML:

Arrange Demo

Not sure how a bunch of nested content_tag() are ‘more readable’ than
that.

Personally i hate the content_tag method. It just obfuscates your DOM.

hi

I tried

<%= content_tag(:h1,“Arrange”.html_safe + content_tag(:span," Demo"))%>

its coming fine.

thanks for everyone .

Follow me on Twitter https://twitter.com/vtrkanna

*Follow me on LinkedIn http://www.linkedin.com/in/vtrkanna

Follow me on Facebook https://www.facebook.com/kannavrk
*
*
kanna(9742665400)

Standard HTML:

example

Content_tag:

content_tag :div, “example”
Am 18.08.2013 11:19 schrieb “Brandon Brown” [email protected]:

Norbert M. wrote in post #1119014:

Standard HTML:

example

Content_tag:

content_tag :div, “example”
Am 18.08.2013 11:19 schrieb “Brandon Brown” [email protected]:

Thanks.

That’s what I know.

But how do I decide which to use?

The most (and i’d say only) useful aspect of content_tag is the ability
to iterate over a collection:

<%= content_tag_for(:tr, @people) do |person| %>

<%= person.first_name %> <%= person.last_name %> <% end %>

which produces items with a predictable id and class.

... ...

see doc:
http://api.rubyonrails.org/classes/ActionView/Helpers/RecordTagHelper.html#method-i-content_tag_for

But in most cases where you just need standard tags, you should plain
ol’ html because it’s much easier to maintain.

<%= @person.name %>

is better than

<%= content_tag :h1, @person.name %>

Is there any body who can explain the differences between using
“standard
HTML” and “content_tag”?

在 2013年8月14日星期三UTC+8上午5时27分08秒,Ruby-Forum.com User写道:

Thanks.

That’s what I know.

But how do I decide which to use?