search for: is_friends_with

Displaying 1 result from an estimated 1 matches for "is_friends_with".

2006 Aug 11
0
pimp my code?? Using self.new in class methods, brittle design & testing such methods
...Group has many Friends (polymorphic two-way as "befriender" and "befriended"--users). from Friend.rb (here the "befriender" and "befriended" that are passed into the model are User objects) def self.befriend_user(befriender, befriended) unless befriender.is_friends_with(befriended) friend = self.new friend.befriender = befriender friend.befriended = befriended befriender.group.friends << friend friend else return end end Should I be breaking this up into smaller methods? Is there a better way to do it? Is my design brittle or...