Rails3 - oauth-plugin problem

I try to use oauth-pluginin the application Railsthat I am developing, but I have problems all the time.

To make sure I’m not mistaken, I started the application from scratch (using Rails 3.0.3). Here are the steps I followed:

  • Create a new rails ( rails.test) application
  • Edited it Gemfileto include:

    gem "oauth-plugin", ">=0.4.0.pre1"
    gem "oauth", "0.4.4"
    
  • Generated oauth-consumerby runningscript/rails g oauth_consumer

  • Edited oauth_consumers.rbto include my keys for Google integration:

    :google=>{ 
      :key=>"anonymous", 
      :secret=>"anonymous",
      :scope=>"https://www.google.com/calendar/feeds/", 
      :options => {
        :site => "http://www.google.com", 
        :request_token_path => "/accounts/OAuthGetRequestToken", 
        :access_token_path => "/accounts/OAuthGetAccessToken", 
        :authorize_path=> "/accounts/OAuthAuthorizeToken"
      },
    }
    
  • Edited routes.rbto add a route for oauth_consumer:

    resources :oauth_consumers
    
  • Edited application_controller.rbto implement the method logged_in?as follows:

    def logged_in?
        true
    end
    
  • Now, when I refer to http://localhost:3000/oauth_consumers/google, I get the following error:

    uninitialized constant GoogleToken
    

- , , ? GoogleToken - , oauth-plugin, , .

+3
3

GoogleToken , "Google" :

script/rails g oauth_consumer google

3:

rails g oauth_consumer google

, :

has_one  :google, :class_name => "GoogleToken", :dependent => :destroy
+3

bundle install Gemfile? , Rails .

0
0
source

Source: https://habr.com/ru/post/1790537/


All Articles