class Admin::CategoriesController < ApplicationController layout "admin" def index @category = Category.all end end 

I get an error

uninitialized constant Admin :: CategoriesController :: Category

How to fix it?

    2 answers 2

    Create a Category model, obviously.

    • @Vladimir Gordeev, Please try to write more detailed answers. - Nicolas Chabanovsky
    • @Expert ♦♦, hey, it was not me who turned the comment in response. - Vladimir Gordeev 1:16

    @Vladimir Gordeev So I did the table,

      rails g model Category title:string description:text 

    Got such a migration:

     class CreateCatigories < ActiveRecord::Migration def change create_table :catigories do |t| t.string :title t.text :description t.timestamps end end end 

    And this model:

      class Catigory < ActiveRecord::Base end 

    PS Everything is clear, incorrectly called the database, catigory instead of category.