diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-04-25 22:08:07 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-04-25 22:08:07 +0000 |
commit | baba45d68952418ccc00cbdd5f3812d95b7cc664 (patch) | |
tree | fa12efc86a6477f5acf376800e8e9aac53680be8 | |
parent | 9ff19d89b950a0c7e9dd073e7fbcfaed74628996 (diff) | |
download | rails-baba45d68952418ccc00cbdd5f3812d95b7cc664.tar.gz rails-baba45d68952418ccc00cbdd5f3812d95b7cc664.tar.bz2 rails-baba45d68952418ccc00cbdd5f3812d95b7cc664.zip |
Resource scaffolding returns the created entity.to_xml.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6580 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index f95bcbb5c6..0e8de48952 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Resource scaffolding returns the created entity.to_xml. [Jeremy Kemper] + * Resource scaffolding responds to new.xml. #8185 [Eric Mill] * Include Active Resource in rails:freeze:edge rake task. [Thomas Fuchs] diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb index f88299dd3d..ac53b6c10d 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb @@ -6,7 +6,7 @@ class <%= controller_class_name %>Controller < ApplicationController respond_to do |format| format.html # index.erb - format.xml { render :xml => @<%= table_name %>.to_xml } + format.xml { render :xml => @<%= table_name %> } end end @@ -17,7 +17,7 @@ class <%= controller_class_name %>Controller < ApplicationController respond_to do |format| format.html # show.erb - format.xml { render :xml => @<%= file_name %>.to_xml } + format.xml { render :xml => @<%= file_name %> } end end @@ -28,7 +28,7 @@ class <%= controller_class_name %>Controller < ApplicationController respond_to do |format| format.html # new.erb - format.xml { render :xml => @<%= file_name %>.to_xml } + format.xml { render :xml => @<%= file_name %> } end end @@ -46,10 +46,10 @@ class <%= controller_class_name %>Controller < ApplicationController if @<%= file_name %>.save flash[:notice] = '<%= class_name %> was successfully created.' format.html { redirect_to <%= file_name %>_url(@<%= file_name %>) } - format.xml { head :created, :location => <%= file_name %>_url(@<%= file_name %>) } + format.xml { render :xml => @<%= file_name %>, :status => :created, :location => <%= file_name %>_url(@<%= file_name %>) } else format.html { render :action => "new" } - format.xml { render :xml => @<%= file_name %>.errors.to_xml } + format.xml { render :xml => @<%= file_name %>.errors } end end end @@ -66,7 +66,7 @@ class <%= controller_class_name %>Controller < ApplicationController format.xml { head :ok } else format.html { render :action => "edit" } - format.xml { render :xml => @<%= file_name %>.errors.to_xml } + format.xml { render :xml => @<%= file_name %>.errors } end end end |