First off, be careful. Since you are using has_and_belongs_to_many for both relationships, then there might be more than one Group for a given User and Assignment So I'm going to implement a method that returns an array of Group s Second, the name of the method User#get_group that takes an assignment id is pretty misleading and un-Ruby-like Here is a clean way to get all of the common groups using Ruby's Array#& the intersection operator. I gave the method a much more revealing name and put it on Group since it is returning Group instances.
Note, however, that it loads Group s that are related to one but not the other: class Group Groups end end Then if you really needed a User#get_groups method, you could define it like this: class User.
First off, be careful. Since you are using has_and_belongs_to_many for both relationships, then there might be more than one Group for a given User and Assignment. So I'm going to implement a method that returns an array of Groups.
Second, the name of the method User#get_group that takes an assignment id is pretty misleading and un-Ruby-like. Here is a clean way to get all of the common groups using Ruby's Array#&, the intersection operator. I gave the method a much more revealing name and put it on Group since it is returning Group instances.
Note, however, that it loads Groups that are related to one but not the other: class Group Groups end end Then if you really needed a User#get_groups method, you could define it like this: class User My Assignment model is simply: class Assignment.
Since you are using has_and_belongs_to_many for both relationships, then there might be more than one Group for a given User and Assignment. So I'm going to implement a method that returns an array of Groups. Second, the name of the method User#get_group that takes an assignment id is pretty misleading and un-Ruby-like.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.