Skip to content

Commit

Permalink
Works on 3.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Feb 16, 2011
1 parent 0dd921c commit b328655
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source "http://rubygems.org"

gemspec

gem "rails", "~> 3.0.0"
gem "rails", "~> 3.0.4"

group :test do
gem "webrat", "0.7.2", :require => false
Expand Down
68 changes: 34 additions & 34 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
PATH
remote: .
specs:
devise (1.1.4)
devise (1.1.5)
bcrypt-ruby (~> 2.1.2)
warden (~> 1.0.2)

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (= 3.0.3)
mail (~> 2.2.9)
actionpack (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
actionmailer (3.0.4)
actionpack (= 3.0.4)
mail (~> 2.2.15)
actionpack (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.6)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.3)
activesupport (= 3.0.3)
activemodel (3.0.4)
activesupport (= 3.0.4)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activerecord (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
arel (2.0.4)
activeresource (3.0.4)
activemodel (= 3.0.4)
activesupport (= 3.0.4)
activesupport (3.0.4)
arel (2.0.8)
bcrypt-ruby (2.1.2)
bson (1.1.2)
bson_ext (1.1.2)
builder (2.1.2)
columnize (0.3.2)
erubis (2.6.6)
abstract (>= 1.0.0)
i18n (0.4.2)
i18n (0.5.0)
linecache (0.43)
mail (2.2.10)
mail (2.2.15)
activesupport (>= 2.3.6)
i18n (~> 0.4.1)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
Expand All @@ -65,19 +65,19 @@ GEM
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
rack-test (0.5.6)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.3)
actionmailer (= 3.0.3)
actionpack (= 3.0.3)
activerecord (= 3.0.3)
activeresource (= 3.0.3)
activesupport (= 3.0.3)
rails (3.0.4)
actionmailer (= 3.0.4)
actionpack (= 3.0.4)
activerecord (= 3.0.4)
activeresource (= 3.0.4)
activesupport (= 3.0.4)
bundler (~> 1.0)
railties (= 3.0.3)
railties (3.0.3)
actionpack (= 3.0.3)
activesupport (= 3.0.3)
railties (= 3.0.4)
railties (3.0.4)
actionpack (= 3.0.4)
activesupport (= 3.0.4)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
Expand All @@ -90,7 +90,7 @@ GEM
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.23)
tzinfo (0.3.24)
warden (1.0.2)
rack (>= 1.0.0)
webrat (0.7.2)
Expand All @@ -110,7 +110,7 @@ DEPENDENCIES
mocha
mongo (= 1.1.2)
mongoid (= 2.0.0.beta.20)
rails (~> 3.0.0)
rails (~> 3.0.4)
ruby-debug (>= 0.10.3)
sqlite3-ruby
warden (~> 1.0.2)
Expand Down
8 changes: 6 additions & 2 deletions lib/devise/failure_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ def redirect_url
end

def http_auth?
!Devise.navigational_formats.include?(request.format.to_sym) || (request.xhr? && Devise.http_authenticatable_on_xhr)
!Devise.navigational_formats.include?(request_format) || (request.xhr? && Devise.http_authenticatable_on_xhr)
end

def http_auth_body
method = :"to_#{request.format.to_sym}"
method = :"to_#{request_format}"
{}.respond_to?(method) ? { :error => i18n_message }.send(method) : i18n_message
end

Expand Down Expand Up @@ -103,5 +103,9 @@ def attempted_path
def store_location!
session[:"#{scope}_return_to"] = attempted_path if request.get? && !http_auth?
end

def request_format
@request_format ||= request.format.respond_to?(:ref) ? request.format.ref : request.format
end
end
end
2 changes: 1 addition & 1 deletion test/failure_app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def call_failure(env_params={})
'REQUEST_METHOD' => 'GET',
'warden.options' => { :scope => :user },
'rack.session' => {},
'action_dispatch.request.formats' => Array(env_params.delete('formats') || :html),
'action_dispatch.request.formats' => Array(env_params.delete('formats') || Mime::HTML),
'rack.input' => "",
'warden' => OpenStruct.new(:message => nil)
}.merge!(env_params)
Expand Down

0 comments on commit b328655

Please sign in to comment.