Ruel Nopal
Ruel Nopal

Reputation: 415

Rails Helper create unintended Array ouput

I have created a rails helper method, So far so good the only problem is it created an unexpected array ouput.

I did try the key value pair using the each method but the array still there.

I'm trying to figure it out how to remove the unexpected array

My application_helper.rb

def bid_items(origin, destination)
        item = Item.where(item_deliver_from: origin).where(item_deliver_to: destination).where(shopper_id: current_user)
end

My search_results.html.rb

<%= bid_items(trip.origin, trip.destination).each do |item| %>
    <div class="card border-0">
        <%= image_tag item.cover_image_url(:cover_image_medium), class: "card-img-top" %>
        <div class="card-body">
            <h5 class="card-title"><%= item.name %></h5>
        </div>
    </div>
<% end %>

Though I got the intended results still, there's an unexpected array check the image I just want to remove this area

See Red X

Upvotes: 1

Views: 44

Answers (1)

Kartikey Tanna
Kartikey Tanna

Reputation: 1459

Remove = sign from <%= bid_items(trip.origin, trip.destination).each do |item| %>

So, make it <% bid_items(trip.origin, trip.destination).each do |item| %>

Upvotes: 2

Related Questions