2011-07-29 5 views

답변

6

당신은 아마도 config 폴더 아래에 포함되어야합니다

app/config/oauth.yml 

이의이 파일을 상상 해보자는 다음과 같이이다 :

development: 
    key: some_key 
    secret: some_secret 
test: 
    key: some_key 
    secret: some_secret 

이제 어딘가에 레일 응용 프로그램에, 아마도 초기화 파일 (app/config/initializers에서)이 파일을 변수 또는 클래스에로드합니다.

all_oauth_config = YAML.load_file(File.join(Rails.root, 'app', 'config', 'oauth.yml')) 
current_oauth_config = all_oauth_config[Rails.env] 
#now do something with this current_oauth_config variable 
+0

여기에 응용 프로그램에서 나는 oauth.yml 파일을 그렇지 않으면 레일이 oauth.yml 파일을로드해야한다는 것을 어떻게 알 수 있습니까? – Kumar

+0

레일스는 레일스를 전혀로드하지 않을 것입니다. –

+0

어디서로드해야합니까? – Kumar

관련 문제