에 넣기 위해, 나는 시간의 지옥에 봉착하지만, 아주 기본적인 흐름을 점점하려면 다음NoMethodError <myMethod> 정의되지 않은 메서드`<myModuleMethod> '기본에 대한 <myModule>
1) 모듈을 정의 뷰 쇼를 var에에 URL을 저장 (또는 반환)
2) 방법
3를 초기화하는 컨트롤러에서이 메서드를 호출) 가지고하는 방법과 그 AuthController에서 URL
NoMethodError #oauth undefined metho D GetAccessToken에 대한`oauthurl '모듈
모듈 : \ lib 디렉토리 \ get_access_token.rb
module GetAccessToken
CONSUMER_TOKEN = { :token=>"mytokenstringwhichisreallylong", :secret=> "mysecretstringwhichisreallylong" }
def self.oauthurl
@oauthurl="https://us.etrade.com/e/t/etws/authorize?key=#{(CONSUMER_TOKEN[:token])}&token="
end
end
컨트롤러 : 응용 프로그램 \ 컨트롤러 \ auth_controllers.rb
require 'get_access_token'
class AuthController < ApplicationController
include GetAccessToken
before_filter :oauthurl1
def oauthurl1
GetAccessToken.oauthurl
end
end
보기 : 응용 프로그램 \ 전망 \ 인증 \ oauth.html.erb
는<% provide(:title, 'oAuth') %>
<h1>oAuth</h1>
<%= link_to "oAuth", @oauthurl %>
내 높은 수준의 목표는이 트레이드의 OAuth 흐름 작업을 진행하는 것입니다,하지만 난 완 나는 다른 모든 사람을 데려가는 것보다 코드의 모든 라인을 이해할 수 있도록 노력하고 있으며,이 기본적인 빌딩 블록을 아직 작동시킬 수는 없습니다.
감사합니다 -이 파마를 시도 utation뿐만 아니라 (application.rb에 설정 라인을 추가; oauthurl1 초기화),하지만 그 불행히도 나를 위해 아직 작동하지 않습니다 - 같은 오류. –