cart.rb:
def vendor3name
@items.first { |item| item.vender.name }
end
When I call the method, I’m looking for the vendor name but it returns the vendor ID#. What am I doing wrong?
<%= @cart.vendor3name %>
CartItem:0x264c358
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want the name of the first vendor of the collection, I think this is the code you must execute:
using
firstwith a block seems to be returning the first id that matches the expression in the block given or something like that.