devise 1.4.7 → 1.4.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

@@ -1,3 +1,11 @@
1
+ == 1.4.8
2
+
3
+ * enhancements
4
+ * Add docs for assets pipeline and Heroku
5
+
6
+ * bug fix
7
+ * confirmation_url was not being set under some circumstances
8
+
1
9
  == 1.4.7
2
10
 
3
11
  * bug fix
@@ -382,13 +382,10 @@ module Devise
382
382
 
383
383
  # Include helpers in the given scope to AC and AV.
384
384
  def self.include_helpers(scope)
385
+ Rails.application.routes.url_helpers.send :include, scope::UrlHelpers
386
+
385
387
  ActiveSupport.on_load(:action_controller) do
386
388
  include scope::Helpers if defined?(scope::Helpers)
387
- include scope::UrlHelpers
388
- end
389
-
390
- ActiveSupport.on_load(:action_view) do
391
- include scope::UrlHelpers
392
389
  end
393
390
  end
394
391
 
@@ -24,25 +24,31 @@ module Devise
24
24
  end
25
25
  end
26
26
 
27
- def self.generate_helpers!
28
- mappings = Devise.mappings.values.map(&:used_helpers).flatten.uniq
29
- routes = Devise::URL_HELPERS.slice(*mappings)
27
+ def self.generate_helpers!(routes=nil)
28
+ routes ||= begin
29
+ mappings = Devise.mappings.values.map(&:used_helpers).flatten.uniq
30
+ Devise::URL_HELPERS.slice(*mappings)
31
+ end
30
32
 
31
33
  routes.each do |module_name, actions|
32
34
  [:path, :url].each do |path_or_url|
33
35
  actions.each do |action|
34
36
  action = action ? "#{action}_" : ""
37
+ method = "#{action}#{module_name}_#{path_or_url}"
35
38
 
36
39
  class_eval <<-URL_HELPERS, __FILE__, __LINE__ + 1
37
- def #{action}#{module_name}_#{path_or_url}(resource_or_scope, *args)
40
+ def #{method}(resource_or_scope, *args)
38
41
  scope = Devise::Mapping.find_scope!(resource_or_scope)
39
42
  send("#{action}\#{scope}_#{module_name}_#{path_or_url}", *args)
40
43
  end
44
+ protected :#{method}
41
45
  URL_HELPERS
42
46
  end
43
47
  end
44
48
  end
45
49
  end
50
+
51
+ generate_helpers!(Devise::URL_HELPERS)
46
52
  end
47
53
  end
48
54
  end
@@ -3,9 +3,10 @@ module Devise
3
3
  module UrlHelpers
4
4
  def self.define_helpers(mapping)
5
5
  return unless mapping.omniauthable?
6
+ method = "#{mapping.name}_omniauth_authorize_path"
6
7
 
7
8
  class_eval <<-URL_HELPERS, __FILE__, __LINE__ + 1
8
- def #{mapping.name}_omniauth_authorize_path(provider, params = {})
9
+ def #{method}(provider, params = {})
9
10
  if Devise.omniauth_configs[provider.to_sym]
10
11
  script_name = request.env["SCRIPT_NAME"]
11
12
 
@@ -16,9 +17,12 @@ module Devise
16
17
  raise ArgumentError, "Could not find omniauth provider \#{provider.inspect}"
17
18
  end
18
19
  end
20
+ protected :#{method}
19
21
  URL_HELPERS
20
22
  end
21
23
 
24
+ protected
25
+
22
26
  def omniauth_authorize_path(resource_or_scope, *args)
23
27
  scope = Devise::Mapping.find_scope!(resource_or_scope)
24
28
  send("#{scope}_omniauth_authorize_path", *args)
@@ -1,3 +1,3 @@
1
1
  module Devise
2
- VERSION = "1.4.7".freeze
2
+ VERSION = "1.4.8".freeze
3
3
  end
@@ -22,4 +22,11 @@ Some setup you must do manually if you haven't yet:
22
22
  <p class="notice"><%= notice %></p>
23
23
  <p class="alert"><%= alert %></p>
24
24
 
25
+ 4. If you are deploying Rails 3.1 on Heroku, you may want to set:
26
+
27
+ config.assets.initialize_on_precompile = false
28
+
29
+ On config/application.rb forcing your application to not access the DB
30
+ or load models when precompiling your assets.
31
+
25
32
  ===============================================================================
@@ -35,7 +35,7 @@ class HelpersTest < ActionController::TestCase
35
35
  end
36
36
 
37
37
  test 'resources methods are not controller actions' do
38
- assert @controller.class.action_methods.empty?
38
+ assert @controller.class.action_methods.empty?, "Expected empty, got #{@controller.class.action_methods.inspect}"
39
39
  end
40
40
 
41
41
  test 'require no authentication tests current mapping' do
@@ -28,31 +28,31 @@ class OmniAuthRoutesTest < ActionController::TestCase
28
28
  end
29
29
 
30
30
  test 'should generate authorization path' do
31
- assert_match "/users/auth/facebook", @controller.omniauth_authorize_path(:user, :facebook)
31
+ assert_match "/users/auth/facebook", @controller.send(:omniauth_authorize_path, :user, :facebook)
32
32
 
33
33
  assert_raise ArgumentError do
34
- @controller.omniauth_authorize_path(:user, :github)
34
+ @controller.send :omniauth_authorize_path, :user, :github
35
35
  end
36
36
  end
37
37
 
38
38
  test 'should generate authorization path for named open_id omniauth' do
39
- assert_match "/users/auth/google", @controller.omniauth_authorize_path(:user, :google)
39
+ assert_match "/users/auth/google", @controller.send(:omniauth_authorize_path, :user, :google)
40
40
  end
41
41
 
42
42
  test 'should generate authorization path with params' do
43
43
  assert_match "/users/auth/open_id?openid_url=http%3A%2F%2Fyahoo.com",
44
- @controller.omniauth_authorize_path(:user, :open_id, :openid_url => "http://yahoo.com")
44
+ @controller.send(:omniauth_authorize_path, :user, :open_id, :openid_url => "http://yahoo.com")
45
45
  end
46
46
 
47
47
  test 'should not add a "?" if no param was sent' do
48
48
  assert_equal "/users/auth/open_id",
49
- @controller.omniauth_authorize_path(:user, :open_id)
49
+ @controller.send(:omniauth_authorize_path, :user, :open_id)
50
50
  end
51
51
 
52
52
  test 'should set script name in the path if present' do
53
53
  @request.env['SCRIPT_NAME'] = '/q'
54
54
 
55
55
  assert_equal "/q/users/auth/facebook",
56
- @controller.omniauth_authorize_path(:user, :facebook)
56
+ @controller.send(:omniauth_authorize_path, :user, :facebook)
57
57
  end
58
58
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
4
  prerelease:
6
- segments:
7
- - 1
8
- - 4
9
- - 7
10
- version: 1.4.7
5
+ version: 1.4.8
11
6
  platform: ruby
12
7
  authors:
13
8
  - "Jos\xC3\xA9 Valim"
@@ -16,7 +11,7 @@ autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
13
 
19
- date: 2011-09-22 00:00:00 +02:00
14
+ date: 2011-10-10 00:00:00 +02:00
20
15
  default_executable:
21
16
  dependencies:
22
17
  - !ruby/object:Gem::Dependency
@@ -27,11 +22,6 @@ dependencies:
27
22
  requirements:
28
23
  - - ~>
29
24
  - !ruby/object:Gem::Version
30
- hash: 17
31
- segments:
32
- - 1
33
- - 0
34
- - 3
35
25
  version: 1.0.3
36
26
  type: :runtime
37
27
  version_requirements: *id001
@@ -43,11 +33,6 @@ dependencies:
43
33
  requirements:
44
34
  - - ~>
45
35
  - !ruby/object:Gem::Version
46
- hash: 25
47
- segments:
48
- - 0
49
- - 0
50
- - 3
51
36
  version: 0.0.3
52
37
  type: :runtime
53
38
  version_requirements: *id002
@@ -59,10 +44,6 @@ dependencies:
59
44
  requirements:
60
45
  - - ~>
61
46
  - !ruby/object:Gem::Version
62
- hash: 7
63
- segments:
64
- - 3
65
- - 0
66
47
  version: "3.0"
67
48
  type: :runtime
68
49
  version_requirements: *id003
@@ -292,18 +273,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
292
273
  requirements:
293
274
  - - ">="
294
275
  - !ruby/object:Gem::Version
295
- hash: 3
296
- segments:
297
- - 0
298
276
  version: "0"
299
277
  required_rubygems_version: !ruby/object:Gem::Requirement
300
278
  none: false
301
279
  requirements:
302
280
  - - ">="
303
281
  - !ruby/object:Gem::Version
304
- hash: 3
305
- segments:
306
- - 0
307
282
  version: "0"
308
283
  requirements: []
309
284