Class ChordTonesController
In: app/controllers/chord_tones_controller.rb
Parent: ApplicationController

Chord Tones REST API

Accesses chord tones within a chord context. Similar to chord notes except chord tones provides more semantic information. Chord notes can be considered a subresource (note-specific information) of chord tones. Chord notes gives only the actual note values (which is more useful for most purposes).

See ChordNotesController.

Methods

Public Instance methods

GET /chord/Cmaj7/tones GET /chord/Cmaj7/tones.xml GET /chord/Cmaj7/tones.js

[Source]

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

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

[Source]

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

Protected Instance methods

[Source]

    # File app/controllers/chord_tones_controller.rb, line 50
50:         def get_chord
51:                 @chord = Chord[params[:chord_id]]
52:         end

[Source]

    # File app/controllers/chord_tones_controller.rb, line 45
45:         def get_chord_tone
46:                 get_chord
47:                 @chord_tone = @chord.tones.all.detect {|ct| ct.position.to_s == params[:id]}
48:         end

[Source]

    # File app/controllers/chord_tones_controller.rb, line 40
40:         def get_chord_tones
41:                 get_chord
42:                 @chord_tones = @chord.tones.all
43:         end

[Validate]