Isabel
Isabel

Reputation: 3

Remove attribute text showing up after post on Rails site

I'm making a random site to post gifs and images to for fun.

After I post something, the attributes show up under it, like this

[#Funpost id: 1, title: "Giphy Test", description: "HAHAHA SO FUNNY", url: "http://i.giphy.com/NuQ1Tz0fhqeEU.gif", created_at: "2015-01-20 00:21:34", updated_at: "2015-01-20 00:21:34">, #<Funpost id: 2, title: "test", description: "", url: "test", created_at: "2015-01-20 03:21:19", updated_at: "2015-01-20 03:21:19">

How do I get rid of it?

Thanks!!

Upvotes: 0

Views: 45

Answers (1)

trosborn
trosborn

Reputation: 1668

You probably have an extra equals signs in your ERB code. e.g., if you do

<%= @funposts.each do |f| %>
  <%= f.title %>
  <%= f.description %>
<% end %>

You will end up displaying the funposts attributes as well as the title and description for each. However if you instead remove the equals sign from the first line

<% @funposts.each do |f| %>
  <%= f.title %>
  <%= f.description %>
<% end %>

You will only show the title and description for each funpost.

Upvotes: 1

Related Questions