mercredi 23 septembre 2015

Why whole db displays in index action view as a plain text?

I created some simple app to upload pictures with paperclip gem. Somehow whole db displays in index action view (look at the screenshot below)

WTF

Here is part of my pic controller:

def index
    @pics = Pic.all
end

Here is my index view:

<h1>Index here</h1>
<div class="index">
    <%= @pics.each do |pic| %>
    <%= link_to pic.nazwa, pic %><br>
    <% end %>
</div>
<%= link_to "Add New Picture", new_pic_path, class: "btn btn-success" %>

application.html.erb is a virgin:

<!DOCTYPE html>
<html>
<head>
  <title>Obrazki</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>

What should I do to fix it?

Aucun commentaire:

Enregistrer un commentaire