camerican / Help-Desk

Help Desk for NYCDA Projects
1 stars 1 forks source link

BookReview App question already answered by Cam #9

Closed AlfeCorona closed 7 years ago

AlfeCorona commented 7 years ago

Question was how to add a book and make page not go to error page when user does not select category. The answer was to got to the books_controller.rb file and type the following:

Below class BooksController < ApplicationController before_action :authenticate_user!, except: [:index, :show]

and

def create
    @categories = Category.all.map{ |c| [c.name, c.id] }

Thanks Cam