Howard Huang
Howard Huang

Reputation: 355

Routing Error - Railscasts #241 Simple OmniAuth

HI all! I am a newbie in Rails, big thanks for your help in anvanced!(Answering this probably naive question)

I tried to follow "Railscasts #241 Simple OmniAuth" to learn how to sign in with twitter, but I get a Routing Error every time. I really don't know what happened here.

No route matches "/test"

Here's my complete file and code structure: The Codes

Thanks, Howard

Upvotes: 1

Views: 572

Answers (2)

mark
mark

Reputation: 10564

You're redirecting to a non-existant test controller and you haven't set up your routes. Have a look at your sessions controller and your routes.rb file.

Looking at the tutorial you're following, you should have this in your sessions controller:

def create  
  ...
  redirect_to root_url, :notice => "Signed in!"  
end  

you have this:

def create
  redirect_to(:controller => 'test', :action => 'index') 
end

In your routes.rb you should have

Blog::Application.routes.draw do |map|  
  root :to => "articles#index"  

  match "/auth/:provider/callback" => "sessions#create"  

  resources :comments  
  resources :articles  
end  

and you have

FsApiTest::Application.routes.draw do

  match "/auth/twitter/callback" => "sessions#create"

I personally prefer reading the written versions of these tutorials, btw: http://asciicasts.com/episodes/241-simple-omniauth

Upvotes: 1

Sam Alex
Sam Alex

Reputation: 1651

Try adding testcontroller in config/routes.rb

Upvotes: 0

Related Questions