Jump to content

[Resolvido] Como listar conteúdo da base de dados em Rails


Recommended Posts

Boa noite,

Estou a tentar listar o resultado de um query à base de dados da seguinte forma:

Na view tenho

<%= @people.each do |person| %>
<%= person.name %>
<% end %>

No entanto o que é mostrado é o seguinte

Nome1 [#<Person id: 7, name: "Nome1", created_at: "2012-12-01 01:57:06", updated_at: "2012-12-01 01:57:06", group_id: 10>]

Alguém sabe como posso evitar a segunda parte? ([#<Person id: 7, name: "Nome1", created_at: "2012-12-01 01:57:06", updated_at: "2012-12-01 01:57:06", group_id: 10>])

Resolvido: Era o <%= @people.each do |person| %> que estava a provocar isto

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.