Topic: map()
Hi,
how can i map first_name and last_name to full_name?
works:
users = user.friendships.map(&:first_name).join(", ")not working
users = user.friendships.map(&:first_name, :last_name).join(", ")thanks for helping
pete
You are not logged in. Please login or register.
Hi,
how can i map first_name and last_name to full_name?
works:
users = user.friendships.map(&:first_name).join(", ")not working
users = user.friendships.map(&:first_name, :last_name).join(", ")thanks for helping
pete
What are the relations between User and Friendship models?
What are the attributes in the both models?
I suppose that ONE user has MANY friendships; In this case, when you call 'friendships' on a 'user':
users = user.friendshipsyou will get an Array of Friendship objects. And of course, calling (mapping) 'first_name' and 'last_name' methods on Friendship object raise an exception. You should call those methods on a User object if you have corresponding attributes/columns/methods defined in User model.
The idea you shared here is amazing, I appreciate your kind way of knowledge sharing!
Essay writing help online essay writers Custom essay writing Buy essay online University essay
I am doing research on this topic ,too.Your article have given me a lot of inspiration
seo agency copywriting services uk
Guarda Moveis tanks for this siteoutsourcing de impressao tanks for this site nice
desenvolvimento para iphone tanks for this site
acompanhantes salvador tanks for this site
Mudanca em Sao Paulo tanks for this site
Hosting provided by aTech Media