0
votes

I am running ruby 1.9.2p18, Devise (1.3.4), Rails (3.0.4) and Omniauth (0.2.6).

Currently I have my webpage doing authentication with Devise, and it works fine.

I am trying to also add facebook authentication to it. I followed the instruction from https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview .

When I do localhost:3000 I get

LoadError (no such file to load -- omniauth/core):
  app/models/user.rb:3:in `<class:User>'
  app/models/user.rb:1:in `<top (required)>'
  config/routes.rb:6:in `block in <top (required)>'
  config/routes.rb:1:in `<top (required)>'

and if refresh the page again sometimes I get

ActionController::RoutingError (No route matches "/")

I looked and under .rvm/gems/ruby-1.9.2-p180/gems/omniauth-0.2.6 I have the directory oa-core/ but not core/ .

I would really appreciate the help, I have no idea how to debug this one!

1

1 Answers

1
votes

2 errors are different.

1. Error:

LoadError (no such file to load -- omniauth/core)

You need to add omniauth to your Gemfile and run 'bundle install'. If you've problem with it this Railscast might help: Railscasts Omniauth 1

Also see 2 Devise videos on Railscasts.

2. Error:

ActionController::RoutingError (No route matches "/")

It says you haven't configured your app to have a main root. The main root is which matches "/".
- First choose which page you would like as landing page you or homepage. If you haven't created one then do it.
- Next you can find all named routes from shell by "rake routes".
- Then open config/routes.rb file and add main root by:

root :to => 'welcome#index'

substitute "welcome#index" with "your_chosen_controllers_name#chosen_method"
Don't add a named route created by Devise because it will end up with infinite loop ("stack level too deep" error).

Note that Devise wiki recommend no to use Devise if you've no prior experience with Rails. In this case I highly recommend to checkout Rails3.1 new has_secure_password? method.
HTH