1

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

1 Answer 1

2

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, Man did not see that :D
This question has been literally asked dozens of times already on Stack Overflow. Answering it only fragments the knowledge, the better reaction would be to close as a duplicate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.