Class: OutroRails::Scales::PickersController

Inherits:
ApplicationController show all
Includes:
GuitarTuningSelectable, InstrumentSelectable, RootSelectable
Defined in:
app/controllers/outro_rails/scales/pickers_controller.rb

Constant Summary

Constants included from RootSelectable

RootSelectable::DEFAULT_ROOT

Constants included from InstrumentSelectable

InstrumentSelectable::INSTRUMENTS

Instance Method Summary collapse

Instance Method Details

#showObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/outro_rails/scales/pickers_controller.rb', line 10

def show
  instrument = instrument_or_default(params[:instrument])
  root       = root_slug_from_params
  type = (
            params[:type].presence ||
            ScalesController::DEFAULT_TYPE
          ).tr("_", "-")
  tuning     = guitar_tuning_or_default(instrument)

  if instrument == "guitar" && !tuning.standard?
    redirect_to guitar_tuning_scale_path(root, type, tuning.slug)
  else
    redirect_to instrument_scale_path(instrument, root, type)
  end
end