Class ModesController
In: app/controllers/modes_controller.rb
Parent: JazzController

Modes REST API

Accessible only within scale context. Represents the defined modes of a given scale.

Methods

Public Instance methods

GET /scales/major/modes GET /scales/major/modes.xml GET /scales/major/modes.js

[Source]

    # File app/controllers/modes_controller.rb, line 13
13:   def index
14:     respond_to do |format|
15:       format.html
16:       format.xml { render :xml => @modes.to_xml }
17:                         format.js { render :text => @modes.to_json }
18:     end
19:   end

GET /scales/major/modes/1 GET /scales/major/modes/1.xml GET /scales/major/modes/1.js

[Source]

    # File app/controllers/modes_controller.rb, line 24
24:   def show
25:     respond_to do |format|
26:       format.html
27:       format.xml { render :xml => @mode.to_xml }
28:                         format.js { render :text => @mode.to_json }
29:     end
30:   end

Protected Instance methods

[Source]

    # File app/controllers/modes_controller.rb, line 45
45:         def find_mode
46:                 find_relateds
47:                 
48:                 @mode = @scale.modes[params[:id]]
49:         end

[Source]

    # File app/controllers/modes_controller.rb, line 35
35:         def find_modes
36:                 find_relateds
37:                 
38:                 @modes = case
39:                   when @scale then @scale.modes
40:                   when @chord then @chord.modes
41:                   else Mode.find(:all)
42:                 end
43:         end

[Source]

    # File app/controllers/modes_controller.rb, line 51
51:         def find_relateds
52:                 @scale = Scale[params[:scale_id]] if params[:scale_id]
53:                 @chord = Chord[params[:chord_id]] if params[:chord_id]
54:         end

[Validate]