has_many :conditions

if you want to use something like #{...} in an association condition, :order, etc, you need to use singel quotes around the sql fragment. the reason being is that the string is being interpreted when the class is loaded and it doesn't know what topic_id is. #{} is not interpreted inside single quotes.