aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails_generator/generators
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails_generator/generators')
-rw-r--r--railties/lib/rails_generator/generators/components/scaffold/USAGE6
-rw-r--r--railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb (renamed from railties/lib/rails_generator/generators/components/scaffold/scaffold_resource_generator.rb)4
-rw-r--r--railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb6
-rw-r--r--railties/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb2
4 files changed, 9 insertions, 9 deletions
diff --git a/railties/lib/rails_generator/generators/components/scaffold/USAGE b/railties/lib/rails_generator/generators/components/scaffold/USAGE
index 60e13c770f..82fd6e2fb4 100644
--- a/railties/lib/rails_generator/generators/components/scaffold/USAGE
+++ b/railties/lib/rails_generator/generators/components/scaffold/USAGE
@@ -32,6 +32,6 @@ Description:
making your new resource accessible from /posts.
Examples:
- ./script/generate scaffold_resource post # no attributes, view will be anemic
- ./script/generate scaffold_resource post title:string created_on:date body:text published:boolean
- ./script/generate scaffold_resource purchase order_id:integer created_at:datetime amount:decimal
+ ./script/generate scaffold post # no attributes, view will be anemic
+ ./script/generate scaffold post title:string created_on:date body:text published:boolean
+ ./script/generate scaffold purchase order_id:integer created_at:datetime amount:decimal
diff --git a/railties/lib/rails_generator/generators/components/scaffold/scaffold_resource_generator.rb b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb
index a10f7f12b3..15eb269d1e 100644
--- a/railties/lib/rails_generator/generators/components/scaffold/scaffold_resource_generator.rb
+++ b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb
@@ -1,4 +1,4 @@
-class ScaffoldResourceGenerator < Rails::Generator::NamedBase
+class ScaffoldGenerator < Rails::Generator::NamedBase
attr_reader :controller_name,
:controller_class_path,
:controller_file_path,
@@ -79,7 +79,7 @@ class ScaffoldResourceGenerator < Rails::Generator::NamedBase
protected
# Override with your own usage banner.
def banner
- "Usage: #{$0} scaffold_resource ModelName [field:type, field:type]"
+ "Usage: #{$0} scaffold ModelName [field:type, field:type]"
end
def scaffold_views
diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb b/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
index f28f364af0..51b912a985 100644
--- a/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
+++ b/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
@@ -45,7 +45,7 @@ class <%= controller_class_name %>Controller < ApplicationController
respond_to do |format|
if @<%= file_name %>.save
flash[:notice] = '<%= class_name %> was successfully created.'
- format.html { redirect_to <%= file_name %>_url(@<%= file_name %>) }
+ format.html { redirect_to(@<%= file_name %>)
format.xml { render :xml => @<%= file_name %>, :status => :created, :location => <%= file_name %>_url(@<%= file_name %>) }
else
format.html { render :action => "new" }
@@ -62,7 +62,7 @@ class <%= controller_class_name %>Controller < ApplicationController
respond_to do |format|
if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
flash[:notice] = '<%= class_name %> was successfully updated.'
- format.html { redirect_to <%= file_name %>_url(@<%= file_name %>) }
+ format.html { redirect_to(@<%= file_name %>) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
@@ -78,7 +78,7 @@ class <%= controller_class_name %>Controller < ApplicationController
@<%= file_name %>.destroy
respond_to do |format|
- format.html { redirect_to <%= table_name %>_url }
+ format.html { redirect_to(<%= table_name %>_url) }
format.xml { head :ok }
end
end
diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb b/railties/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb
index 88a4c9bf77..32adca08ad 100644
--- a/railties/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb
+++ b/railties/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb
@@ -14,7 +14,7 @@
<% end -%>
<td><%%= link_to 'Show', <%= singular_name %> %></td>
<td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
- <td><%%= link_to 'Destroy', <%= singular_name %>), :confirm => 'Are you sure?', :method => :delete %></td>
+ <td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<%% end %>
</table>