Forum: Ruby on Rails whats this error (uninitialized constant) ?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
E3513c4edd6810bb4b9914b58da2a2c3?d=identicon&s=25 Jamal Soueidan (jamal)
on 2007-02-19 15:34

I get this error whenever I try to create new row (db)

uninitialized constant BlogController::Blog

my controller looks like this:

class BlogController < ApplicationController

  layout "index"

  def create
      @blog =[:blog])
        flash[:notice] = 'Blog was successfully created.'
        redirect_to :action => 'list'
        render :action => 'new'


and this is my view simple...

<%= form_tag('create') %>


  <dd><%= text_field "blog", "title", "size" => 20 %></dd>

  <dd><textarea cols="25" id="blog_comment" name="blog[comment]"

  <dd><%= submit_tag("Add New Title") %></dd>


<%= end_form_tag %>

why does that error happens (uninitialized constant
1fba4539b6cafe2e60a2916fa184fc2f?d=identicon&s=25 unknown (Guest)
on 2007-02-19 16:00
(Received via mailing list)
Hi --

On Mon, 19 Feb 2007, Jamal Soueidan wrote:

>      end
> </dl>
> <%= end_form_tag %>
> why does that error happens (uninitialized constant
> BlogController::Blog)?

Do you have a Blog model?  It looks like you don't, so the program is
assuming that Blog is supposed to be a constant inside the scope of
BlogCongroller -- and there is no such constant, so it fails.

What's in app/models?


Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (
    (See what readers are saying!
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (
This topic is locked and can not be replied to.