Internal application Configuration settings are handled through this REST-enabled controller.
Methods
Public Instance methods
Create a new Configuration object and store it in the database. Only supports XML format.
[ show source ]
# File app/controllers/configurations_controller.rb, line 21
21: def create
22: respond_to do |format|
23: format.html { head :method_not_allowed }
24:
25: if @config.save
26: format.xml {
27: headers['Location'] = configuration_url(@config)
28: render :xml => @config.to_xml, :status => :created
29: }
30: else
31: format.xml {
32: render :xml => @config.errors.to_xml,
33: :status => :unprocessable_entity
34: }
35: end
36: end
37: end
Delete a give configuration from the back-end dabatase. Only supports XML format.
[ show source ]
# File app/controllers/configurations_controller.rb, line 63
63: def destroy
64: respond_to do |format|
65: format.html { head :method_not_allowed }
66:
67: if @config.destroy
68: format.xml { head :ok }
69: else
70: format.xml { render :xml => @config.errors.to_xml, :status => :unprocessable_entity }
71: end
72: end
73: end
Get all the Configuration objects. It only supports XML format. Sample request: localhost:3004/configurations.xml
[ show source ]
# File app/controllers/configurations_controller.rb, line 10
10: def index
11: @configs = Configuration.find(:all)
12: respond_to do |format|
13: format.html { head :method_not_allowed }
14:
15: format.xml { render :xml => @configs.to_xml}
16: end
17: end
Retrieve a Configuration object. Only supports XML format.
[ show source ]
# File app/controllers/configurations_controller.rb, line 40
40: def show
41: respond_to do |format|
42: format.html { head :method_not_allowed }
43: format.xml { render :xml => @config.to_xml }
44: end
45: end
Update the attributes (name, value) of a Configurarion object. Only supports XML format.
[ show source ]
# File app/controllers/configurations_controller.rb, line 49
49: def update
50: respond_to do |format|
51: format.html { head :method_not_allowed }
52:
53: if @config.update_attributes(params[:config])
54: format.xml { render :xml => @config.to_xml }
55: else
56: format.xml { render :xml => @config.errors.to_xml, :status => :unprocessable_entity }
57: end
58: end
59: end