aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-05-16 01:23:34 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-05-16 01:23:34 +0000
commit4f2a950ce2f29d4c6ce777d5a949440b6c2a440f (patch)
treef8138e47643edf98835ee3d85366b58b36795c97 /railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
parent73fbf7771bbfc6c3c8c4ddd8f4f84eb6bfac504d (diff)
downloadrails-4f2a950ce2f29d4c6ce777d5a949440b6c2a440f.tar.gz
rails-4f2a950ce2f29d4c6ce777d5a949440b6c2a440f.tar.bz2
rails-4f2a950ce2f29d4c6ce777d5a949440b6c2a440f.zip
Make way for the new and improved scaffold
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6745 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb')
-rw-r--r--railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb58
1 files changed, 0 insertions, 58 deletions
diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb b/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
deleted file mode 100644
index c059e74536..0000000000
--- a/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-class <%= controller_class_name %>Controller < ApplicationController
-<% unless suffix -%>
- def index
- list
- render :action => 'list'
- end
-<% end -%>
-
-<% for action in unscaffolded_actions -%>
- def <%= action %><%= suffix %>
- end
-
-<% end -%>
- # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
- verify :method => :post, :only => [ :destroy<%= suffix %>, :create<%= suffix %>, :update<%= suffix %> ],
- :redirect_to => { :action => :list<%= suffix %> }
-
- def list<%= suffix %>
- @<%= singular_name %>_pages, @<%= plural_name %> = paginate :<%= plural_name %>, :per_page => 10
- end
-
- def show<%= suffix %>
- @<%= singular_name %> = <%= model_name %>.find(params[:id])
- end
-
- def new<%= suffix %>
- @<%= singular_name %> = <%= model_name %>.new
- end
-
- def create<%= suffix %>
- @<%= singular_name %> = <%= model_name %>.new(params[:<%= singular_name %>])
- if @<%= singular_name %>.save
- flash[:notice] = '<%= model_name %> was successfully created.'
- redirect_to :action => 'list<%= suffix %>'
- else
- render :action => 'new<%= suffix %>'
- end
- end
-
- def edit<%= suffix %>
- @<%= singular_name %> = <%= model_name %>.find(params[:id])
- end
-
- def update
- @<%= singular_name %> = <%= model_name %>.find(params[:id])
- if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
- flash[:notice] = '<%= model_name %> was successfully updated.'
- redirect_to :action => 'show<%= suffix %>', :id => @<%= singular_name %>
- else
- render :action => 'edit<%= suffix %>'
- end
- end
-
- def destroy<%= suffix %>
- <%= model_name %>.find(params[:id]).destroy
- redirect_to :action => 'list<%= suffix %>'
- end
-end