app/controllers/artists_controller.rb
#from homepage, users can search by artist. so, if the user searches (by name) then that Artist will be displayed.
#if there are no results, an alert flashes and All artists are displayed. 

from homepage, users can search by artist. so, if the user searches (by name) then that Artist will be displayed.
if there are no results, an alert flashes and All artists are displayed.
from homepage users can search by artist . so if the user searches ( by name ) then that Artist will be displayed . if there are no results an alert flashes and All artists are displayed .
def index
        if params[:name]
            @artists = Artist.where('name LIKE ?', "%#{params[:name]}")
            if @artists == []
                flash[:alert] = 'No results.'
                @artists = Artist.all
            end
        else 
            @artists = Artist.all
        end
    end
def index if params [ :name ] @artists = Artist . where ( 'name LIKE ?' , "%#{params[:name]}" ) if @artists == [ ] flash [ :alert ] = 'No results.' @artists = Artist . all end else @artists = Artist . all end end
from homepage, users can search by artist.
from homepage users can search by artist .