jbearden
jbearden

Reputation: 1869

Rails 3: Mongoid returns #<Mongoid::Contextual::Mongo:ID> tag with array

I've got an array of @contacts that is being iterated on a different model controller view:

<%= @contacts.each do |item| %>
<p>
<%= item.name %>
</p>
<% end %>

Here's what the controller looks like:

@user = current_user
@contacts =  Contact.desc('created_at').where(:user_id => @user.id)

It functions as anticipated but drops this line with the iterated text:

#<Mongoid::Contextual::Mongo:0x007fe0bc0efbd8>

What the heck is going on?

Upvotes: 1

Views: 685

Answers (1)

cdesrosiers
cdesrosiers

Reputation: 8892

Change

<%= @contacts.each do |item| %>

to

<% @contacts.each do |item| %>

(remove the =)

Upvotes: 6

Related Questions