ruby on rails - In RoR, is there an easy way to prevent the view from outputting <p> tags? -


i'm new ruby , rails , have simple controller shows item database in default view. when displaying in html outputting <p> tags along text content. there way prevent happening? suppose if there isn't, there @ least way set default css class same output in statement such this:

<% @items.each |i| %>      <%= i.itemname %>     <div class="menu_body">            <a href="#">link-1</a>            </div> <% end %> 

so problem <%= i.itemname %> part. there way stop wrapping in own <p> tags? or set css class output?

thanks!

you need enclose html tag of choice. if required can escape bad code using <%=h i.itemname %> example:

<% @items.each |i| %>      <div><%=h i.itemname %></div>     <div class="menu_body">            <a href="#">link-1</a>            </div> <% end %> 

edit: ryan bigg right. rails doesn't output <p> tag. sorry wrong info.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -