Skip to content

Commit 0227cd1

Browse files
committed
bug fix: cannot find Rails.oauth
1 parent fb72127 commit 0227cd1

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

init.rb

+5-26
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
1-
OAUTH_CONFIG = {:sites => {}, :model => nil }
2-
3-
Dir["#{Rails.root}/config/oauth/*.yml"].collect{|f|
4-
YAML.load_file(f).each_pair{|site,props|
5-
OAUTH_CONFIG[:sites].update(site.to_sym => {}) unless OAUTH_CONFIG[:sites].has_key? site.to_sym
6-
if props.class == Hash
7-
props.each_pair{|k,v|
8-
OAUTH_CONFIG[:sites][site.to_sym].update(k.to_sym => v)
9-
}
10-
end
11-
}
12-
}
1+
require 'oauth/consumer'
132

14-
module Rails
15-
class << self
16-
def oauth
17-
OAUTH_CONFIG[:sites]
18-
end
19-
def oauth_model
20-
OAUTH_CONFIG[:model]
21-
end
22-
def oauth_model= model
23-
OAUTH_CONFIG[:model]=model
24-
end
25-
end
26-
end
3+
require 'oauth_side/ext/hash'
274

5+
require 'oauth_controller'
6+
require 'oauth_token'
7+
require 'oauth_side/model'
288

29-
require 'oauth/consumer'
309
require 'oauth_side'

lib/oauth_side.rb

+26-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1-
require 'oauth_side/ext/hash'
2-
require 'oauth_controller'
3-
require 'oauth_token'
4-
require 'oauth_side/model'
1+
OAUTH_CONFIG = {:sites => {}, :model => nil }
2+
3+
Dir["#{Rails.root}/config/oauth/*.yml"].collect{|f|
4+
YAML.load_file(f).each_pair{|site,props|
5+
OAUTH_CONFIG[:sites].update(site.to_sym => {}) unless OAUTH_CONFIG[:sites].has_key? site.to_sym
6+
if props.class == Hash
7+
props.each_pair{|k,v|
8+
OAUTH_CONFIG[:sites][site.to_sym].update(k.to_sym => v)
9+
}
10+
end
11+
}
12+
}
13+
14+
module Rails
15+
class << self
16+
def oauth
17+
OAUTH_CONFIG[:sites]
18+
end
19+
def oauth_model
20+
OAUTH_CONFIG[:model]
21+
end
22+
def oauth_model= model
23+
OAUTH_CONFIG[:model]=model
24+
end
25+
end
26+
end
527

628
Rails.oauth.each_pair{|site,props|
729
OauthController.class_eval <<-EOF

0 commit comments

Comments
 (0)