Habtm find question


#1

The model “Raids” and “Characters” have a habtm relationship. I’m
having a tough time finding all the characters who have attended a
raid in the last week. I have a timestamp column in the raids table.

Its easy to grab all the raids each char has attended in the last week
but i cant think of how to get all the characters.

Thanks in advance.


#2

You might want to use has_many :through and put the timestamp in join
table.

On 8/2/07, Koalemos removed_email_address@domain.invalid wrote:


Cheers!


#3

Having the timestamp in the join table seems redundant and not very
rails like since the timestamp would be the same for every row which
points to a particular raid. while it would allow me to do something
like:
has_many :recent_chars, :though => :join, :source =>:raid, :conditions
=> ‘timestamp <= 1.week.ago’ (assuming this is even correct)

with my inexperience i’m not sure if that is the best way to go about
doing things.