This controller exposes the REST operations required to manage the Note resource.
Methods
Public Instance methods
[ show source ]
# File app/controllers/notes_controller.rb, line 24
24: def create
25: respond_to do |format|
26: format.html { head :method_not_allowed }
27:
28: if @note.save
29: @modified = true
30: format.xml {
31: headers['Location'] = node_notes_url(@note.id)
32: render :xml => @note.to_xml, :status => :created
33: }
34: else
35: format.xml {
36: render :xml => @note.errors.to_xml,
37: :status => :unprocessable_entity
38: }
39: end
40: end
41: end
Remove a Note from the back-end database. Formats supported: XML
[ show source ]
# File app/controllers/notes_controller.rb, line 69
69: def destroy
70: respond_to do |format|
71: format.html { head :method_not_allowed }
72:
73: if @note.destroy
74: @modified = true
75: format.xml { head :ok }
76: else
77: format.xml { render :xml => @note.errors.to_xml, :status => :unprocessable_entity }
78: end
79: end
80: end
[ show source ]
# File app/controllers/notes_controller.rb, line 12
12: def index
13: @notes = Note.find(:all, :conditions => {:node_id => @node.id})
14: respond_to do |format|
15: format.html { head :method_not_allowed }
16:
17: format.xml { render :xml => @notes.to_xml}
18: format.json { render :json => @notes.to_json(:include => :category)}
19: end
20: end
Retrieve a Note given its :id Formats supported: XML
[ show source ]
# File app/controllers/notes_controller.rb, line 45
45: def show
46: respond_to do |format|
47: format.html { head :method_not_allowed }
48: format.xml { render :xml => @note.to_xml}
49: end
50: end
Update the attributes of a Note Formats supported: XML
[ show source ]
# File app/controllers/notes_controller.rb, line 54
54: def update
55: respond_to do |format|
56: format.html { head :method_not_allowed }
57:
58: if @note.update_attributes(params[:note])
59: @modified = true
60: format.xml { render :xml => @note.to_xml }
61: else
62: format.xml { render :xml => @note.errors.to_xml, :status => :unprocessable_entity }
63: end
64: end
65: end