Rails content_tag vs tag

Viewed 3099

What's the difference between content_tag and tag in Rails? From what I've read, it seems that content_tag requires content to be passed to it.

Why does this matter? What's different syntactically, as well as what cases would I use one vs the other?

2 Answers

basically tag makes an empty tag and content_tag is used for building, well tags with some content.

say you use tag to build IMG tags and use content_tag for building DIVs

Related