Again, I'd recommend looking into how you could leverage [ActiveRecord::Associations](http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html) to simplify this code.