some codes with Active Record Associations