def find_or_create_membership
user_membership = User::Membership.where(:group_id => self.group_id,
:user_id => self.invitee_id).first_or_create(:status => "invited")
end
和
def find_or_create_membership
user_membership = User::Membership.where(:group_id => self.group_id,
:user_id => self.invitee_id).first_or_create(:status => "declined")
end
除了第一个将status
设置为“邀请”而第二个设置为“已拒绝”之外,这些方法是相同的。有没有办法可以通过关注点将参数传递给这些方法?