It's a bit different than you think. user2.networks does only return a list of networks when executed, because networks is not an array. It is an ActiveRecord::Relation. That's why user1.networks.merge(user2.networks) does something completely different than iterating through the networks.
It's a bit different than you think.
user2.networks
does only return a list of networks when executed, becausenetworks
is not an array. It is anActiveRecord::Relation
. That's whyuser1.networks.merge(user2.networks)
does something completely different than iterating through thenetworks
.I understand. What I wanted to say was that
user2.networks
is the list of networksuser2
has created, not the ones he's following.