Code was created following the Ryan's railscast at http://railscasts.com/episodes/238-mongoid-revised