Class ScaleTonesController
In: app/controllers/scale_tones_controller.rb
Parent: JazzController

Scale Tones REST API

Accesses scale tones within a scale context. Similar to scale notes except scale tones gives more detailed information about one member of a scale, whereas scale notes simply gives the note value only (which is more useful for most purposes).

See ScaleNotesController.

Methods

Public Instance methods

GET /scale/Cmaj7/tones GET /scale/Cmaj7/tones.xml GET /scale/Cmaj7/tones.js

[Source]

    # File app/controllers/scale_tones_controller.rb, line 16
16:   def index
17:     respond_to do |format|
18:       format.html
19:       format.xml { render :xml => @scale_tones.to_xml }
20:                         format.js { render :text => @scale_tones.to_json }
21:     end
22:   end

GET /scale/Cmaj7/1 (Where 1 is position) GET /scale/Cmaj7/1.xml GET /scale/Cmaj7/1.js

[Source]

    # File app/controllers/scale_tones_controller.rb, line 27
27:   def show
28:     respond_to do |format|
29:       format.html
30:       format.xml { render :xml => @scale_tone.to_xml }
31:                         format.js { render :text => @scale_tone.to_json }
32:     end
33:   end

Protected Instance methods

[Source]

    # File app/controllers/scale_tones_controller.rb, line 50
50:         def find_scale
51:                 @scale = Scale[params[:scale_id]]
52:         end

[Source]

    # File app/controllers/scale_tones_controller.rb, line 44
44:         def find_scale_tone
45:                 find_scale
46:                 
47:                 @scale_tone = @scale.tones.all.detect {|ct| ct.position.to_s == params[:id]}
48:         end

[Source]

    # File app/controllers/scale_tones_controller.rb, line 38
38:         def find_scale_tones
39:                 find_scale
40:                 
41:                 @scale_tones = @scale.tones.all
42:         end

[Validate]