Ruby on Rails Saturday, August 17, 2013

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写道:
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
>
> <h1>Arrange <span>Demo</span></h1>
>
>
>More readably (IMO):
>
> <%= content_tag :h1 do %>
>   Arrange <%= content_tag :span, 'Demo' %>
> <% end %>

What's wrong with just using standard HTML:

<h1>Arrange <span>Demo</span></h1>

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.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b3d28ac9-6ce9-4512-914e-93f2a8cc567d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment