| Class | ChordsController |
| In: |
app/controllers/chords_controller.rb
|
| Parent: | JazzController |
Could be referenced in many RESTful contexts:
GET /chords GET /chords.xml GET /chords.js
# File app/controllers/chords_controller.rb, line 15
15: def index
16: respond_to do |format|
17: format.html
18: format.xml { render :xml => @chords.to_xml(:skip_types => true, :methods => [:symbols_list], :except => [:id, :parent_id, :chord_quality_id]) }
19: format.js { render :text => @chords.to_json(:except => [:id, :parent_id, :chord_quality_id]) }
20: end
21: end
GET /chords/maj7 GET /chords/maj7.xml GET /chords/maj7.js
# File app/controllers/chords_controller.rb, line 26
26: def show
27: respond_to do |format|
28: format.html
29: format.xml { render :xml => @chord.to_xml(:skip_types => true, :methods => [:symbols_list], :except => [:id, :chord_quality_id, :parent_id], :include => [:chord_quality, :parent]) }
30: format.js { render :text => @chord.to_json(:except => [:id, :chord_quality_id, :parent_id], :include => [:parent]) }
31: end
32: end
# File app/controllers/chords_controller.rb, line 49
49: def find_chord
50: find_relateds
51:
52: @chord = case
53: when @mode then @mode.chords[params[:id]]
54: when @scale then @scale.chords[params[:id]]
55: when @chord_quality then @chord_quality.chords[params[:id]]
56: when @notes_collection then @notes_collection.chords[params[:id]]
57: else Chord[params[:id]]
58: end
59: end
# File app/controllers/chords_controller.rb, line 37
37: def find_chords
38: find_relateds
39:
40: @chords = case
41: when @mode then @mode.chords
42: when @scale then @scale.chords
43: when @chord_quality then @chord_quality.chords
44: when @notes_collection then @notes_collection.chords
45: else Chord.find(:all, :include => [:symbols])
46: end
47: end
# File app/controllers/chords_controller.rb, line 61
61: def find_relateds
62: @scale = Scale[params[:scale_id]] if params[:scale_id]
63: @mode = @scale.modes[params[:mode_id]] if params[:mode_id] and @scale
64: @chord_quality = ChordQuality[params[:chord_quality_id]] if params[:chord_quality_id]
65: @notes_collection = NotesCollection[params[:notes_collection_id]] if params[:notes_collection_id]
66: end