Search code examples
ruby-on-railsrubyrails-administrateadministrate

Undefined method `camelize' for nil:NilClass (NoMethodError) in Rails using Administrate framework


I am trying to use Administrate to create a customizable/flexible admin dashboard for a web app I am working on. I have followed the instructions on https://github.com/thoughtbot/administrate

I keep getting this recurring error:

`block in class_name': undefined method `camelize' for nil:NilClass (NoMethodError)

even though I create a Admin model (as suggested by previous posts and questions). The steps I took:

  1. rails generate model Admin
  2. rake db:migrate
  3. rails generate administrate:install
routes.rb
Rails.application.routes.draw do

  namespace :admin do
    root to: "#index"
  end
  # welcome
  root 'welcome#index'
  get 'welcome/index'
end 

Please let me know if there is anything else I can provide to help you answer the question!


Solution

  • Try deleting generated code from routes.rb:

      namespace :admin do
        root to: "#index"
      end
    

    and run again:

    rails generate administrate:install: