Skip to content

Uninitialized constant Admin::ResourceController #4

@laurobecker

Description

@laurobecker

The generated code for the "cats" example didn't work. When I try to access http://localhost:3000/admin/cats, I have a Uninitialized constant Admin::ResourceController.

My controller code is:

class Admin::CatsController < Admin::ResourceController

  def index
    @cats = Cat.page(params[:page] || 1).per(50)
  end

  def new
    @cat = Cat.new
  end

  def create
    @cat = Cat.new(params[:cat])
    if @cat.save
      flash[:notice] = "Successfully created Cat."
      redirect_to admin_cats_url
    else
      render :action => 'new'
    end
  end

  def edit
    @cat = Cat.find(params[:id])
  end

  def update
    @page = Cat.find(params[:id])
    if @cat.update_attributes(params[:cat])
      flash[:notice] = "Successfully updated Cat."
      redirect_to admin_cats_url
    else
      render :action => 'edit'
    end
  end

  def destroy
    @cat = Cat.find(params[:id])
    @cat.destroy
    flash[:notice] = "Successfully destroyed Cat."
    redirect_to admin_cats_url
  end

end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions