Sha256: f6226e15cfee167255d4876cb1dd443cdf68f9919d276f088f2aaeb0bf3bfbcb

Contents?: true

Size: 1.44 KB

Versions: 23

Compression:

Stored size: 1.44 KB

Contents

class Admin::<%= @controller_name.pluralize.capitalize %>Controller < Admin::BaseController

  def index
    @<%= @controller_name.underscore.pluralize %> = <%= @controller_name.singularize.capitalize %>.all
  end

  def new
    @<%= @controller_name.singularize.underscore %> = <%= @controller_name.singularize.capitalize %>.new
  end

  def create
    @<%= @controller_name.singularize.underscore %> = <%= @controller_name.singularize.capitalize %>.new params[:<%= @controller_name.singularize.underscore %>]
    if @<%= @controller_name.singularize.underscore %>.save
      redirect_to <%= @controller_name.underscore.pluralize %>_path
    else
      render action: :new
    end
  end

  def edit
    @<%= @controller_name.singularize.underscore %> = <%= @controller_name.singularize.capitalize %>.find params[:id]
  end

  def update
    @<%= @controller_name.singularize.underscore %> = <%= @controller_name.singularize.capitalize %>.find params[:id]
    if @<%= @controller_name.singularize.underscore %>.update_attributes params[:<%= @controller_name.underscore %>]
      redirect_to <%= @controller_name.underscore.pluralize %>_path
    else
      render action: :edit
    end
  end

  def destroy
    @<%= @controller_name.singularize.underscore %> = <%= @controller_name.singularize.capitalize %>.find params[:id]
    @<%= @controller_name.singularize.underscore %>.destroy
    redirect_to <%= @controller_name.pluralize.underscore.pluralize %>_path
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
pixelforce_cms-2.6 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-2.5 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-2.4 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-2.3 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-2.2 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-2.0 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-1.0 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.9 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.8 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.7 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.6 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.5 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.4 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.3 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.2 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.9.1 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.8 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.7 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.5 lib/generators/pixelforce_cms/templates/admin_controller.rb
pixelforce_cms-0.9.4 lib/generators/pixelforce_cms/templates/admin_controller.rb