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
if request.post? @blog = Blog.new(params[:blog])
if @blog.save
flash[:notice] = ‘Blog was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end
end
end
and this is my view simple…
<%= form_tag(‘create’) %>
Title
<%= text_field "blog", "title", "size" => 20 %>
Comments
<%= submit_tag("Add New Title") %>
<%= end_form_tag %>
why does that error happens (uninitialized constant
BlogController::Blog)?
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.