Browse files

Rename `verify_request_format!` to `verify_requested_format!`.

See #164 for more details.
  • Loading branch information...
1 parent a01d406 commit a67af6e5b5157ed4c24c4f6bc503d4a77378da71 @lucasmazza lucasmazza committed Jul 25, 2016
View
4 CHANGELOG.md
@@ -1,3 +1,7 @@
+## Unreleased
+
+* `verify_request_format!` is aliased to `verify_requested_format!` now.
+
## 2.2.0
* Added the `verify_request_format!` method, that can be used as a `before_action`
View
4 README.md
@@ -222,13 +222,13 @@ end
mime type was not configured through the class level `respond_to`, but the
action will still be executed and any side effects (like creating a new record)
will still occur. To raise the `UnknownFormat` exception before your action
-is invoked you can set the `verify_request_format!` method as a `before_action`
+is invoked you can set the `verify_requested_format!` method as a `before_action`
on your controller.
```ruby
class WidgetsController < ApplicationController
respond_to :json
- before_action :verify_request_format!
+ before_action :verify_requested_format!
# POST /widgets.html won't reach the `create` action.
def create
View
6 lib/action_controller/respond_with.rb
@@ -216,9 +216,9 @@ def respond_with(*resources, &block)
# class PeopleController < ApplicationController
# respond_to :html, :xml, :json
#
- # before_action :verify_request_format!
+ # before_action :verify_requested_format!
# end
- def verify_request_format!
+ def verify_requested_format!
mimes = collect_mimes_from_class_level
collector = ActionController::MimeResponds::Collector.new(mimes, request.variant)
@@ -227,6 +227,8 @@ def verify_request_format!
end
end
+ alias :verify_request_format! :verify_requested_format!
+
# Collect mimes declared in the class method respond_to valid for the
# current action.
def collect_mimes_from_class_level #:nodoc:
View
4 ..._controller/verify_request_format_test.rb → ...ontroller/verify_requested_format_test.rb
@@ -6,7 +6,7 @@ class ThingsController < ApplicationController
respond_to :js
respond_to :html, :only => [:show, :new]
- before_action :verify_request_format!
+ before_action :verify_requested_format!
attr_reader :called
@@ -20,7 +20,7 @@ def action
alias :new :action
end
-class VerifyRequestFormatTest < ActionController::TestCase
+class VerifyRequestedFormatTest < ActionController::TestCase
tests ThingsController
def test_strict_mode_shouldnt_call_action

0 comments on commit a67af6e

Please sign in to comment.