SophieDeBenedetto/purrfectmatch

View on GitHub
app/controllers/welcome_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class WelcomeController < ApplicationController
    # for test purposes callback to user auth at the root welcome#index
    # before_action :authenticate_user!
    def index
        @pets = random_select(Pet.all, 4)

    end


    private

    def random_select(array, n)
    result = []
    n.times do
      result << array[rand(array.length)]
    end
    result
  end
end