Sha256: 591e443af6ae7efc881d50699cf27cccf076c3e1fe6c8636c7029a1318051787

Contents?: true

Size: 1.36 KB

Versions: 31

Compression:

Stored size: 1.36 KB

Contents

class <%= @name_plural_camel %>Controller
  include Mack::Controller
  
  # GET /<%= @name_plural %>
  def index
    @<%= @name_plural %> = <%= @name_singular_camel %>.all
  end

  # GET /<%= @name_plural %>/1
  def show
    @<%= @name_singular %> = <%= @name_singular_camel %>.get(params[:id])
  end

  # GET /<%= @name_plural %>/new
  def new
    @<%= @name_singular %> = <%= @name_singular_camel %>.new
  end

  # GET /<%= @name_plural %>/1/edit
  def edit
    @<%= @name_singular %> = <%= @name_singular_camel %>.get(params[:id])
  end

  # POST /<%= @name_plural %>
  def create
    @<%= @name_singular %> = <%= @name_singular_camel %>.new(params[:<%= @name_singular %>])
    if @<%= @name_singular %>.save
      redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular %>))
    else
      render(:action, "new")
    end
  end

  # PUT /<%= @name_plural %>/1
  def update
    @<%= @name_singular %> = <%= @name_singular_camel %>.get(params[:id])
    if @<%= @name_singular %>.update_attributes(params[:<%= @name_singular %>])
      redirect_to(<%= @name_plural %>_show_url(:id => @<%= @name_singular %>))
    else
      render(:action, "edit")
    end
  end

  # DELETE /<%= @name_plural %>/1
  def delete
    @<%= @name_singular %> = <%= @name_singular_camel %>.get(params[:id])
    @<%= @name_singular %>.destroy
    redirect_to(<%= @name_plural %>_index_url)
  end

end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
mack-data_mapper-0.6.1.1 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.6.0.1 lib/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.6.0 lib/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.6.1.2 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.6.1 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.7.0 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.7.0.1 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.7.1.1 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.0.101 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.7.1 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.0.1 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.0.2 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.0 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.0.3 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.1 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.2 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.3.1 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-data_mapper-0.8.3 lib/mack-data_mapper/scaffold_generator/templates/app/controllers/controller.rb.template
mack-orm-0.8.2 lib/mack-orm/scaffold_generator/templates/app/controllers/controller.rb.template
mack-orm-0.7.1.1 lib/mack-orm/scaffold_generator/templates/app/controllers/controller.rb.template