diff options
Diffstat (limited to 'railties/lib/rails/generators/rails/scaffold_controller')
3 files changed, 0 insertions, 132 deletions
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/USAGE b/railties/lib/rails/generators/rails/scaffold_controller/USAGE deleted file mode 100644 index d60a3c3680..0000000000 --- a/railties/lib/rails/generators/rails/scaffold_controller/USAGE +++ /dev/null @@ -1,20 +0,0 @@ -Description: - Stubs out a scaffolded controller and its views. Pass the model name, - either CamelCased or under_scored, and a list of views as arguments. - The controller name is retrieved as a pluralized version of the model - name. - - To create a controller within a module, specify the model name as a - path like 'parent_module/controller_name'. - - This generates a controller class in app/controllers and invokes helper, - template engine and test framework generators. - -Example: - `./script/generate scaffold_controller CreditCard` - - Credit card controller with URLs like /credit_card/debit. - Controller: app/controllers/credit_cards_controller.rb - Functional Test: test/functional/credit_cards_controller_test.rb - Views: app/views/credit_cards/index.html.erb [...] - Helper: app/helpers/credit_cards_helper.rb diff --git a/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb b/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb deleted file mode 100644 index e544e29892..0000000000 --- a/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'rails/generators/resource_helpers' - -module Rails - module Generators - class ScaffoldControllerGenerator < NamedBase - include ResourceHelpers - - check_class_collision :suffix => "Controller" - - class_option :orm, :banner => "NAME", :type => :string, :required => true, - :desc => "ORM to generate the controller for" - - class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller" - - def create_controller_files - template 'controller.rb', File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb") - end - - hook_for :template_engine, :test_framework, :as => :scaffold - - # Invoke the helper using the controller (pluralized) name. - hook_for :helper, :as => :scaffold do |base, invoked| - base.invoke invoked, [ base.controller_name ] - end - end - end -end diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb deleted file mode 100644 index 874e96a2b4..0000000000 --- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +++ /dev/null @@ -1,85 +0,0 @@ -class <%= controller_class_name %>Controller < ApplicationController -<% unless options[:singleton] -%> - # GET /<%= table_name %> - # GET /<%= table_name %>.xml - def index - @<%= table_name %> = <%= orm_class.all(class_name) %> - - respond_to do |format| - format.html # index.html.erb - format.xml { render :xml => @<%= table_name %> } - end - end -<% end -%> - - # GET /<%= table_name %>/1 - # GET /<%= table_name %>/1.xml - def show - @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> - - respond_to do |format| - format.html # show.html.erb - format.xml { render :xml => @<%= file_name %> } - end - end - - # GET /<%= table_name %>/new - # GET /<%= table_name %>/new.xml - def new - @<%= file_name %> = <%= orm_class.build(class_name) %> - - respond_to do |format| - format.html # new.html.erb - format.xml { render :xml => @<%= file_name %> } - end - end - - # GET /<%= table_name %>/1/edit - def edit - @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> - end - - # POST /<%= table_name %> - # POST /<%= table_name %>.xml - def create - @<%= file_name %> = <%= orm_class.build(class_name, "params[:#{file_name}]") %> - - respond_to do |format| - if @<%= orm_instance.save %> - format.html { redirect_to(@<%= file_name %>, :notice => '<%= class_name %> was successfully created.') } - format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> } - else - format.html { render :action => "new" } - format.xml { render :xml => @<%= orm_instance.errors %>, :status => :unprocessable_entity } - end - end - end - - # PUT /<%= table_name %>/1 - # PUT /<%= table_name %>/1.xml - def update - @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> - - respond_to do |format| - if @<%= orm_instance.update_attributes("params[:#{file_name}]") %> - format.html { redirect_to(@<%= file_name %>, :notice => '<%= class_name %> was successfully updated.') } - format.xml { head :ok } - else - format.html { render :action => "edit" } - format.xml { render :xml => @<%= orm_instance.errors %>, :status => :unprocessable_entity } - end - end - end - - # DELETE /<%= table_name %>/1 - # DELETE /<%= table_name %>/1.xml - def destroy - @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> - @<%= orm_instance.destroy %> - - respond_to do |format| - format.html { redirect_to(<%= table_name %>_url) } - format.xml { head :ok } - end - end -end |