Class: OutroRails::Chords::PickersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/outro_rails/chords/pickers_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/outro_rails/chords/pickers_controller.rb', line 6

def show
  query = params[:q].to_s.strip
  return redirect_to chords_path if query.empty?

  chord = Chord.where(slug: lookup_candidates(query)).first

  if chord
    redirect_to chord_path(chord)
  else
    redirect_to chords_path(missing: query)
  end
end