In home_controller.rb index method @user=User.all.to_a from @user=User.all (According to mongoid documentation) , otherwise user will get error that user is a nil class.