samedi 20 juin 2015

Too many fields in query output

I have a query and I only want to output three variables

Relationship.select('follower_id as source, followed_id as target, value').map(&:attributes)

however the result I am getting includes the id variable as below which I dont want. How do I get rid of it?

{"source"=>1, "target"=>3, "value"=>1, "id"=>nil}, 
{"source"=>1, "target"=>4, "value"=>1, "id"=>nil}, 
{"source"=>1, "target"=>5, "value"=>1, "id"=>nil}, 
{"source"=>2, "target"=>3, "value"=>1, "id"=>nil}

Aucun commentaire:

Enregistrer un commentaire