I’m at a complete loss. I can get to new and edit and when I submit the
new post or submit the edit, i’ll get:
Routing Error
No route matches “/knodes/new”
or
Routing Error
No route matches “/knodes/1/edit”
Here’s the controller:
class KnodesController < ApplicationController
before_filter :authenticate, :only => [:create, :destroy]
before_filter :authorized_user, :only => :destroy
GET /knodes
# GET /knodes.xml
def index
@knodes = Knodes.all
end
GET /knodes/1
GET /knodes/1.xml
def show
@knodes = Knodes.find(params[:id])
end
GET /knodes/new
GET /knodes/new.xml
def new
@knodes = Knodes.new
end
GET /knodes/1/edit
def edit
@knodes = Knodes.find(params[:id])
end
POST /knodes
POST /posts.xml
def create
@knodes = current_user.knodes.build(params[:knodes])
if @knodes.save
redirect_to @user
else
render ‘edit’
end
end
# PUT /knodes/1
PUT /knodes/1.xml
def update
@knodes = Knodes.find(params[:id])
if @knodes.update_attributes(params[:knodes])
redirect_to @knodes
else
render 'edit'
end
end
DELETE /knodes/1
DELETE /knodes1.xml
def destroy
@knodes = Knodes.find(params[:id])
@knodes.destroy
respond_to do |format|
format.html { redirect_to(knodes_url) }
format.xml { head :ok }
end
end
private
def authorized_user
@knodes = Knodes.find(params[:id])
redirect_to root_path unless current_user?(@knodes.user)
end
end
And my routes
sessions_new GET /sessions/new(.:format)
{:controller=>“sessions”, :action=>“new”}
knodes_new GET /knodes/new(.:format)
{:controller=>“knodes”, :action=>“new”}
users_new GET /users/new(.:format) {:controller=>“users”,
:action=>“new”}
pages_home GET /pages/home(.:format) {:controller=>“pages”,
:action=>“home”}
pages_about GET /pages/about(.:format) {:controller=>“pages”,
:action=>“about”}
pages_contact GET /pages/contact(.:format) {:controller=>“pages”,
:action=>“contact”}
pages_changelog GET /pages/changelog(.:format) {:controller=>“pages”,
:action=>“changelog”}
contact /contact(.:format) {:controller=>“pages”,
:action=>“contact”}
about /about(.:format) {:controller=>“pages”,
:action=>“about”}
signup /signup(.:format) {:controller=>“users”,
:action=>“new”}
signin /signin(.:format)
{:controller=>“sessions”, :action=>“new”}
signout /signout(.:format)
{:controller=>“sessions”, :action=>“destroy”}
changelog /changelog(.:format) {:controller=>“pages”,
:action=>“changelog”}
knodes GET /knodes(.:format)
{:controller=>“knodes”, :action=>“index”}
knodes POST /knodes(.:format)
{:controller=>“knodes”, :action=>“create”}
new_knode GET /knodes/new(.:format)
{:controller=>“knodes”, :action=>“new”}
edit_knode GET /knodes/:id/edit(.:format)
{:controller=>“knodes”, :action=>“edit”}
knode GET /knodes/:id(.:format)
{:controller=>“knodes”, :action=>“show”}
knode PUT /knodes/:id(.:format)
{:controller=>“knodes”, :action=>“update”}
knode DELETE /knodes/:id(.:format)
{:controller=>“knodes”, :action=>“destroy”}
users GET /users(.:format) {:controller=>“users”,
:action=>“index”}
users POST /users(.:format) {:controller=>“users”,
:action=>“create”}
new_user GET /users/new(.:format) {:controller=>“users”,
:action=>“new”}
edit_user GET /users/:id/edit(.:format) {:controller=>“users”,
:action=>“edit”}
user GET /users/:id(.:format) {:controller=>“users”,
:action=>“show”}
user PUT /users/:id(.:format) {:controller=>“users”,
:action=>“update”}
user DELETE /users/:id(.:format) {:controller=>“users”,
:action=>“destroy”}
sessions GET /sessions(.:format)
{:controller=>“sessions”, :action=>“index”}
sessions POST /sessions(.:format)
{:controller=>“sessions”, :action=>“create”}
new_session GET /sessions/new(.:format)
{:controller=>“sessions”, :action=>“new”}
session DELETE /sessions/:id(.:format)
{:controller=>“sessions”, :action=>“destroy”}
root /(.:format) {:controller=>“pages”,
:action=>“home”}
Also this is my first post on the ruby-forum! I hate that it’s for a
problem i’m having. I’ve been looking for a good ruby/rails forum for a
while.
HOWDY!