9

I have watched railscast http://railscasts.com/episodes/236-omniauth-part-2

And tried to implement the code, everything worked well in development environment. when I executed using rails s -e production, I get the error below

omniauth_callbacks_controller.rb:1: uninitialized constant Devise::OmniauthCallbacksController (NameError)

The code snippet that caused error is here

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController

My Gemfile


gem 'aws-s3'
gem 'paperclip'
gem 'rails', '3.0.0'
gem 'pg'
gem 'gravatar_image_tag', '0.1.0'
gem 'will_paginate', '3.0.pre2'
gem 'devise'
gem 'omniauth'
gem 'nifty-generators'

My Gemfile.lock file (just related ones)


    devise (1.1.5)
      bcrypt-ruby (~> 2.1.2)
      warden (~> 1.0.2)

    nokogiri (1.4.4)
    oa-basic (0.1.6)
      multi_json (~> 0.0.2)
      nokogiri (~> 1.4.2)
      oa-core (= 0.1.6)
      rest-client (~> 1.6.0)
    oa-core (0.1.6)
      rack (~> 1.1)
    oa-enterprise (0.1.6)
      net-ldap (~> 0.1.1)
      nokogiri (~> 1.4.2)
      oa-core (= 0.1.6)
      pyu-ruby-sasl (~> 0.0.3.1)
      rubyntlm (~> 0.1.1)
    oa-oauth (0.1.6)
      multi_json (~> 0.0.2)
      nokogiri (~> 1.4.2)
      oa-core (= 0.1.6)
      oauth (~> 0.4.0)
      oauth2 (~> 0.1.0)
    oa-openid (0.1.6)
      oa-core (= 0.1.6)
      rack-openid (~> 1.2.0)
      ruby-openid-apps-discovery
    oauth (0.4.4)
    oauth2 (0.1.0)
      faraday (~> 0.5.0)
      multi_json (~> 0.0.4)
    omniauth (0.1.6)
      oa-basic (= 0.1.6)
      oa-core (= 0.1.6)
      oa-enterprise (= 0.1.6)
      oa-oauth (= 0.1.6)
      oa-openid (= 0.1.6)

My development.rb file


SampleApp::Application.configure do
  config.cache_classes = false
  config.whiny_nils = true
  config.consider_all_requests_local       = true
  config.action_view.debug_rjs             = true
  config.action_controller.perform_caching = false
  config.action_mailer.raise_delivery_errors = false
  config.active_support.deprecation = :log
  config.action_dispatch.best_standards_support = :builtin
  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end

My production.rb file


SampleApp::Application.configure do
  config.cache_classes = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.action_dispatch.x_sendfile_header = "X-Sendfile"
  config.serve_static_assets = false
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
end

Can anyone help?

Yekmer Simsek
  • 4,102
  • 3
  • 21
  • 19

2 Answers2

5

In devise 1.2, it's supports integration with OmniAuth directly.

Check devise wiki for OmniAuth

ecleel
  • 11,748
  • 15
  • 48
  • 48
1

What's your Gemfile look like? Did you stick the gem 'omniauth' statement in a :development group by any chance?

Keith Gaddis
  • 4,113
  • 23
  • 20
  • can you edit your question and include both the development.rb and production.rb you're using? – Keith Gaddis Nov 29 '10 at 01:48
  • Hi when I changed devise version to 1.1.4 and changed cache classes to false in production.rb as config.cache_classes = false this worked, but I it is not a good solution as it decreses performance on server. Do you have a better solution. – Yekmer Simsek Nov 29 '10 at 12:42
  • The cache_classes doesn't make sense. What happens when you just use version 1.1.4 of devise? – Keith Gaddis Nov 29 '10 at 14:31
  • I think routing of some files has changed in version 1.1.5, but what fixed the error was the config.cache_classes, I know it is strange. I have a similar project as this combination and production.rb file worked well. I know it is strange and I am doing something wrong. – Yekmer Simsek Nov 29 '10 at 19:47