Im going to do a walk through of my problem. It involves the scaffolding.
I was trying to scaffold the basic part of a forum im going to show you exactly what i did.
I started by opening cmd and typing: rails forums
It created the first part.
I then, created the database's
Had no problem doing this.
The database.yml file is perfect as well this is the database tho.
PHP Code:CREATE TABLE `forums` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) collate latin1_general_ci NOT NULL default '',
`description` text collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ;
After "Everything" was done. this is where it runs into problems
I ran scaffold i typed:
ruby script/generate scaffold forums
it created the controllers and everything.
I then went to routes.rb and edited it
I deleted the index in the public html.PHP Code:ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# You can have the root of your site routed by hooking up ''
# -- just remember to delete public/index.html.
map.connect '', :controller => "forums"
# Allow downloading Web Service WSDL as a file with an extension
# instead of a file named 'wsdl'
map.connect ':controller/service.wsdl', :action => 'wsdl'
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'
end
I then ran: ruby script/server
It then gave this error
http://minnisite.com/sss.JPG
and i gave this to the IRC channel for Rails. They couldnt even help me I posted my forums_controller.rb
here is it:
Then they asked me to post the forums.rb so here it is.PHP Code:class ForumsController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see [url]http://www.w3.org/2001/tag/doc/whenToUseGet.html[/url])
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@forums_pages, @forums = paginate :forums, :per_page => 10
end
def show
@forums = Forums.find(params[:id])
end
def new
@forums = Forums.new
end
def create
@forums = Forums.new(params[:forums])
if @forums.save
flash[:notice] = 'Forums was successfully created.'
redirect_to :action => 'list'
else
render :action => 'new'
end
end
def edit
@forums = Forums.find(params[:id])
end
def update
@forums = Forums.find(params[:id])
if @forums.update_attributes(params[:forums])
flash[:notice] = 'Forums was successfully updated.'
redirect_to :action => 'show', :id => @forums
else
render :action => 'edit'
end
end
def destroy
Forums.find(params[:id]).destroy
redirect_to :action => 'list'
end
end
forums.rb
PHP Code:class Forums < ActiveRecord::Base
end
What is Wrong guys? I get that error everytime. i do something.



but cant get the other part to work i keep messing with it and no luck.

Bookmarks