Skip to content

Commit

Permalink
tested parsing json from post body
Browse files Browse the repository at this point in the history
  • Loading branch information
rpl committed Aug 15, 2008
1 parent acbca8d commit 64b3431
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/controllers/admin/sheets.rb
Expand Up @@ -45,6 +45,9 @@ def new
end

def create

params.merge!(Merb::Request.query_parse(request.raw_post))

case params[:type]
when "incident":
@sheet = IncidentSheet.new
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/RESTcrud.js
Expand Up @@ -24,12 +24,12 @@ var RESTcrud = function(base_url) {
});
};

this.create = function(success_callback, failure_callback) {
this.create = function(params, success_callback, failure_callback) {
Ext.Ajax.request({
method: 'GET',
headers: { "Content-Type": "text/json" },
url: base_url+'/new'+this._format,
params: {},
params: params,
success: success_callback,
failure: failure_callback
});
Expand Down
6 changes: 3 additions & 3 deletions public/javascripts/admin/rest_tester.js
Expand Up @@ -67,7 +67,7 @@ Ext.onReady(function(){
});
break;
case "create":
model.create(function success(response) {
model.create(params,function success(response) {
cp.body.dom.innerHTML = String(response.responseText);
},
function failure(response) {
Expand Down Expand Up @@ -171,8 +171,8 @@ Ext.onReady(function(){
disable_all(['rest-params','rest-body']);
break;
case "create":
enable_all(['rest-base-url']);
disable_all(['rest-id','rest-params','rest-body']);
enable_all(['rest-base-url','rest-params']);
disable_all(['rest-id','rest-body']);
break;
case "save":
enable_all(['rest-base-url','rest-body']);
Expand Down

0 comments on commit 64b3431

Please sign in to comment.