diff --git a/src/classes/AbstractController/Base.html b/src/classes/AbstractController/Base.html index 4fad9e6b82..a5147678c4 100644 --- a/src/classes/AbstractController/Base.html +++ b/src/classes/AbstractController/Base.html @@ -149,17 +149,11 @@
abstract!()Define a controller as abstract. See internal_methods for more details.
Define a controller as abstract. See internal_methods for more details.
action_methods()A Set of method names that should be considered actions. This includes all public instance methods on a controller, less any internal methods (see internal_methods), adding back in any methods that are internal, but still exist on the class itself.
A Set of method names that should be considered actions. This includes all public instance methods on a controller, less any internal methods (see internal_methods), adding back in any methods that are internal, but still exist on the class itself.
clear_action_methods!()action_methods are cached and there is sometimes a need to refresh them. ::clear_action_methods! allows you to do that, so next time you run action_methods, they will be recalculated.
action_methods are cached and there is sometimes a need to refresh them. ::clear_action_methods! allows you to do that, so next time you run action_methods, they will be recalculated.
controller_path()Returns the full controller name, underscored, without the ending Controller.
+Returns the full controller name, underscored, without the ending Controller.
class MyApp::MyPostsController < AbstractController::Base
@@ -279,8 +256,7 @@
MyApp::MyPostsController.controller_path # => "my_app/my_posts"
- internal_methods()A list of all internal methods for a controller. This finds the first abstract superclass of a controller, and gets a list of all public instance methods on that abstract class. Public instance methods of a controller would normally be considered action methods, so methods declared on abstract classes are being removed. (ActionController::Metal and ActionController::Base are defined as abstract)
A list of all internal methods for a controller. This finds the first abstract superclass of a controller, and gets a list of all public instance methods on that abstract class. Public instance methods of a controller would normally be considered action methods, so methods declared on abstract classes are being removed. (ActionController::Metal and ActionController::Base are defined as abstract)
method_added(name)Refresh the cached action_methods when a new action_method is added.
Refresh the cached action_methods when a new action_method is added.
supports_path?()Returns true if the given controller is capable of rendering a path. A subclass of AbstractController::Base may return false. An Email controller for example does not support paths, only full URLs.
Returns true if the given controller is capable of rendering a path. A subclass of AbstractController::Base may return false. An Email controller for example does not support paths, only full URLs.
action_methods()Delegates to the class’s ::action_methods.
Delegates to the class’s ::action_methods.
action_nameReturns the name of the action this controller is processing.
-Returns the name of the action this controller is processing.
+available_action?(action_name)Returns true if a method for the action is available and can be dispatched, false otherwise.
+Returns true if a method for the action is available and can be dispatched, false otherwise.
Notice that action_methods.include?("foo") may return false and available_action?("foo") returns true because this method considers actions that are also available through other means, for example, implicit render ones.
action_name - The name of an action to be tested
controller_path()Delegates to the class’s ::controller_path.
Delegates to the class’s ::controller_path.
formatsReturns the formats that can be processed by the controller.
-Returns the formats that can be processed by the controller.
+performed?()Tests if a response body is set. Used to determine if the process_action callback needs to be terminated in AbstractController::Callbacks.
Tests if a response body is set. Used to determine if the process_action callback needs to be terminated in AbstractController::Callbacks.
process(action, ...)Calls the action going through the entire Action Dispatch stack.
+Calls the action going through the entire Action Dispatch stack.
The actual method that is called is determined by calling method_for_action. If no method can handle the action, then an AbstractController::ActionNotFound error is raised.
response_bodyReturns the body of the HTTP response sent by the controller.
-Returns the body of the HTTP response sent by the controller.
+view_cache_dependencies()cache(key, options = {}, &block)Convenience accessor.
-Convenience accessor.
+view_cache_dependency(&dependency)cache_store()cache_store=(store)combined_fragment_cache_key(key)Given a key (as described in expire_fragment), returns a key array suitable for use in reading, writing, or expiring a cached fragment. All keys begin with :views, followed by ENV["RAILS_CACHE_ID"] or ENV["RAILS_APP_VERSION"] if set, followed by any controller-wide key prefix values, ending with the specified key value.
Given a key (as described in expire_fragment), returns a key array suitable for use in reading, writing, or expiring a cached fragment. All keys begin with :views, followed by ENV["RAILS_CACHE_ID"] or ENV["RAILS_APP_VERSION"] if set, followed by any controller-wide key prefix values, ending with the specified key value.
expire_fragment(key, options = nil)Removes fragments from the cache.
+Removes fragments from the cache.
key can take one of three forms:
options is passed through to the cache store’s delete method (or delete_matched, for Regexp keys).
fragment_exist?(key, options = nil)Check if a cached fragment from the location signified by key exists (see expire_fragment for acceptable formats).
Check if a cached fragment from the location signified by key exists (see expire_fragment for acceptable formats).
read_fragment(key, options = nil)Reads a cached fragment from the location signified by key (see expire_fragment for acceptable formats).
Reads a cached fragment from the location signified by key (see expire_fragment for acceptable formats).
write_fragment(key, content, options = nil)Writes content to the location signified by key (see expire_fragment for acceptable formats).
Writes content to the location signified by key (see expire_fragment for acceptable formats).
fragment_cache_key(value = nil, &key)Allows you to specify controller-wide key prefixes for cache fragments. Pass either a constant value, or a block which computes a value each time a cache key is generated.
Allows you to specify controller-wide key prefixes for cache fragments. Pass either a constant value, or a block which computes a value each time a cache key is generated.
For example, you may want to prefix all fragment cache keys with a global version identifier, so you can easily invalidate all caches.
@@ -83,8 +78,7 @@_insert_callbacks(callbacks, block = nil)Take callback names and an optional callback proc, normalize them, then call the block with each callback. This allows us to abstract the normalization across several methods that use it.
+Take callback names and an optional callback proc, normalize them, then call the block with each callback. This allows us to abstract the normalization across several methods that use it.
options - A hash of options to be used when adding the callback.
_normalize_callback_options(options)If :only or :except are used, convert the options into the :if and :unless options of ActiveSupport::Callbacks.
If :only or :except are used, convert the options into the :if and :unless options of ActiveSupport::Callbacks.
The basic idea is that :only => :index gets converted to :if => proc {|c| c.action_name == "index" }.
except - The callback should be run for all actions except this action.
after_action(names, block)
+Append a callback after actions. See _insert_callbacks for parameter details.
Append a callback after actions. See _insert_callbacks for parameter details.
append_after_action(names, block)
+Append a callback after actions. See _insert_callbacks for parameter details.
Append a callback after actions. See _insert_callbacks for parameter details.
append_around_action(names, block)
+Append a callback around actions. See _insert_callbacks for parameter details. set up before_action, prepend_before_action, skip_before_action, etc. for each of before, after, and around.
Append a callback around actions. See _insert_callbacks for parameter details. set up before_action, prepend_before_action, skip_before_action, etc. for each of before, after, and around.
append_before_action(names, block)
+Append a callback before actions. See _insert_callbacks for parameter details.
Append a callback before actions. See _insert_callbacks for parameter details.
If the callback renders or redirects, the action will not run. If there are additional callbacks scheduled to run after that callback, they are also cancelled.
-around_action(names, block)
+Append a callback around actions. See _insert_callbacks for parameter details.
Append a callback around actions. See _insert_callbacks for parameter details.
before_action(names, block)
+Append a callback before actions. See _insert_callbacks for parameter details.
Append a callback before actions. See _insert_callbacks for parameter details.
If the callback renders or redirects, the action will not run. If there are additional callbacks scheduled to run after that callback, they are also cancelled.
-prepend_after_action(names, block)
+Prepend a callback after actions. See _insert_callbacks for parameter details.
Prepend a callback after actions. See _insert_callbacks for parameter details.
prepend_around_action(names, block)
+Prepend a callback around actions. See _insert_callbacks for parameter details.
Prepend a callback around actions. See _insert_callbacks for parameter details.
prepend_before_action(names, block)
+Prepend a callback before actions. See _insert_callbacks for parameter details.
Prepend a callback before actions. See _insert_callbacks for parameter details.
If the callback renders or redirects, the action will not run. If there are additional callbacks scheduled to run after that callback, they are also cancelled.
-skip_after_action(names)
+Skip a callback after actions. See _insert_callbacks for parameter details.
Skip a callback after actions. See _insert_callbacks for parameter details.
skip_around_action(names)
+Skip a callback around actions. See _insert_callbacks for parameter details.
Skip a callback around actions. See _insert_callbacks for parameter details.
skip_before_action(names)
+Skip a callback before actions. See _insert_callbacks for parameter details.
Skip a callback before actions. See _insert_callbacks for parameter details.
generate_method_for_mime(mime)new(message = nil)_helpers()all_helpers_from_path(path)
+Returns a list of helper names in a given path.
+Returns a list of helper names in a given path.
ActionController::Base.all_helpers_from_path 'app/helpers'
# => ["application", "chart", "rubygems"]
- _helpers_for_modification()clear_helpers()Clears up all existing helpers in this class, only keeping the helper with the same name as this class.
-Clears up all existing helpers in this class, only keeping the helper with the same name as this class.
+helper(*args, &block)Includes the given modules in the template class.
+Includes the given modules in the template class.
Modules can be specified in different ways. All of the following calls include FooHelper:
helper_method(*methods)Declare a controller method as a helper. For example, the following makes the current_user and logged_in? controller methods available to the view:
Declare a controller method as a helper. For example, the following makes the current_user and logged_in? controller methods available to the view:
class ApplicationController < ActionController::Base
helper_method :current_user, :logged_in?
@@ -323,8 +292,7 @@ Parameters
-
method[, method] - A name or names of a method on the controller to be made available on the view.
- inherited(klass)When a class is inherited, wrap its helper module in a new module. This ensures that the parent class’s module can be changed independently of the child class’s.
-When a class is inherited, wrap its helper module in a new module. This ensures that the parent class’s module can be changed independently of the child class’s.
+modules_for_helpers(modules_or_helper_prefixes)
+Given an array of values like the ones accepted by helper, this method returns an array with the corresponding modules, in the same order.
Given an array of values like the ones accepted by helper, this method returns an array with the corresponding modules, in the same order.
ActionController::Base.modules_for_helpers(["application", "chart", "rubygems"])
# => [ApplicationHelper, ChartHelper, RubygemsHelper]
- with(routes, include_path_helpers = true)render(*args, &block)Normalizes arguments and options, and then delegates to render_to_body and sticks the result in self.response_body.
Normalizes arguments and options, and then delegates to render_to_body and sticks the result in self.response_body.
Supported options depend on the underlying render_to_body implementation.
render_to_body(options = {})Performs the actual template rendering.
-Performs the actual template rendering.
+render_to_string(*args, &block)Similar to render, but only returns the rendered template as a string, instead of setting self.response_body.
Similar to render, but only returns the rendered template as a string, instead of setting self.response_body.
If a component extends the semantics of response_body (as ActionController extends it to be anything that responds to the method each), this method needs to be overridden in order to still return a string.
rendered_format()Returns Content-Type of rendered content.
Returns Content-Type of rendered content.
view_assigns()This method should return a hash with assigns. You can overwrite this configuration per controller.
-This method should return a hash with assigns. You can overwrite this configuration per controller.
+_normalize_args(action = nil, options = {})Normalize args by converting render "foo" to render action: "foo" and render "foo/bar" to render file: "foo/bar".
Normalize args by converting render "foo" to render action: "foo" and render "foo/bar" to render file: "foo/bar".
_normalize_options(options)Normalize options.
-Normalize options.
+_process_options(options)Process extra options.
-Process extra options.
+l(object, **options)
+ Alias for:
+ localize.
+
localize(object, **options)Delegates to I18n.localize.
Delegates to I18n.localize.
+ Also aliased as:
+
+ l.
+
t(key, **options)
+ Alias for:
+ translate.
+
translate(key, **options)Delegates to I18n.translate.
Delegates to I18n.translate.
When the given key starts with a period, it will be scoped by the current controller and action. So if you call translate(".foo") from PeopleController#index, it will convert the call to I18n.translate("people.index.foo"). This makes it less repetitive to translate many keys within the same controller / action and gives you a simple framework for scoping them consistently.
+ Also aliased as:
+
+ t.
+
_routes()_routes()action_methods()gem_version()Returns the currently loaded version of Action Cable as a Gem::Version.
Returns the currently loaded version of Action Cable as a Gem::Version.
version()Returns the currently loaded version of Action Cable as a Gem::Version.
Returns the currently loaded version of Action Cable as a Gem::Version.
server()Singleton instance of the server
Singleton instance of the server
action_methods()A list of method names that should be considered actions. This includes all public instance methods on a channel, less any internal methods (defined on Base), adding back in any methods that are internal, but still exist on the class itself.
A list of method names that should be considered actions. This includes all public instance methods on a channel, less any internal methods (defined on Base), adding back in any methods that are internal, but still exist on the class itself.
Set - A set of all methods that should be considered actions.
new(connection, identifier, params = {})clear_action_methods!()action_methods are cached and there is sometimes need to refresh them. ::clear_action_methods! allows you to do that, so next time you run action_methods, they will be recalculated.
action_methods are cached and there is sometimes need to refresh them. ::clear_action_methods! allows you to do that, so next time you run action_methods, they will be recalculated.
method_added(name)Refresh the cached action_methods when a new action_method is added.
Refresh the cached action_methods when a new action_method is added.
perform_action(data)Extract the action name from the passed data and process it via the channel. The process will ensure that the action requested is a public method on the channel declared by the user (so not one of the callbacks like subscribed).
Extract the action name from the passed data and process it via the channel. The process will ensure that the action requested is a public method on the channel declared by the user (so not one of the callbacks like subscribed).
subscribe_to_channel()This method is called after subscription has been added to the connection and confirms or rejects the subscription.
-This method is called after subscription has been added to the connection and confirms or rejects the subscription.
+defer_subscription_confirmation!()defer_subscription_confirmation?()ensure_confirmation_sent()reject()subscribed()Called once a consumer has become a subscriber of the channel. Usually the place to set up any streams you want this channel to be sending to the subscriber.
-Called once a consumer has become a subscriber of the channel. Usually the place to set up any streams you want this channel to be sending to the subscriber.
+subscription_confirmation_sent?()subscription_rejected?()transmit(data, via: nil)Transmit a hash of data to the subscriber. The hash will automatically be wrapped in a JSON envelope with the proper channel identifier marked as the recipient.
-Transmit a hash of data to the subscriber. The hash will automatically be wrapped in a JSON envelope with the proper channel identifier marked as the recipient.
+unsubscribed()Called once a consumer has cut its cable connection. Can be used for cleaning up connections or marking users as offline or the like.
-Called once a consumer has cut its cable connection. Can be used for cleaning up connections or marking users as offline or the like.
+broadcast_to(model, message)broadcasting_for(model)broadcast_to(broadcastables, message)Broadcast a hash to a unique broadcasting for this array of broadcastables in this channel.
Broadcast a hash to a unique broadcasting for this array of broadcastables in this channel.
broadcasting_for(broadcastables)Returns a unique broadcasting identifier for this model in this channel:
Returns a unique broadcasting identifier for this model in this channel:
CommentsChannel.broadcasting_for("all") # => "comments:all"
You can pass an array of objects as a target (e.g. Active Record model), and it would be serialized into a string under the hood.
-after_subscribe(*methods, &block)This callback will be triggered after the Base#subscribed method is called, even if the subscription was rejected with the Base#reject method.
This callback will be triggered after the Base#subscribed method is called, even if the subscription was rejected with the Base#reject method.
To trigger the callback only on successful subscriptions, use the Base#subscription_rejected? method:
after_subscribe :my_method, unless: :subscription_rejected?
-
+ Also aliased as:
+
+ on_subscribe.
+
after_unsubscribe(*methods, &block)
+ Also aliased as:
+
+ on_unsubscribe.
+
before_subscribe(*methods, &block)before_unsubscribe(*methods, &block)on_subscribe(*methods, &block)
+ Alias for:
+ after_subscribe.
+
on_unsubscribe(*methods, &block)
+ Alias for:
+ after_unsubscribe.
+
confirmed?()rejected?()start_periodic_timers()Make periodic timers no-op
-Make periodic timers no-op
+
+ Also aliased as:
+
+ stop_periodic_timers.
+
stop_all_streams()stop_periodic_timers()
+ Alias for:
+ start_periodic_timers.
+
stream_from(broadcasting, *)streams()new(identifiers = {})connection_identifier()transmit(cable_message)channel_name()channel_name()Returns the name of the channel, underscored, without the Channel ending. If the channel is in a namespace, then the namespaces are represented by single colon separators in the channel name.
Returns the name of the channel, underscored, without the Channel ending. If the channel is in a namespace, then the namespaces are represented by single colon separators in the channel name.
ChatChannel.channel_name # => 'chat'
Chats::AppearancesChannel.channel_name # => 'chats:appearances'
FooChats::BarAppearancesChannel.channel_name # => 'foo_chats:bar_appearances'
- new(name)periodically(callback_or_method_name = nil, every:, &block)Periodically performs a task on the channel, like updating an online user counter, polling a backend for new status messages, sending regular “heartbeat” messages, or doing some internal work and giving progress updates.
+Periodically performs a task on the channel, like updating an online user counter, polling a backend for new status messages, sending regular “heartbeat” messages, or doing some internal work and giving progress updates.
Pass a method name or lambda argument or provide a block to call. Specify the calling period in seconds using the every: keyword argument.
stop_all_streams()Unsubscribes all streams associated with this channel from the pubsub queue.
-Unsubscribes all streams associated with this channel from the pubsub queue.
+stop_stream_for(model)Unsubscribes streams for the model.
Unsubscribes streams for the model.
stop_stream_from(broadcasting)Unsubscribes streams from the named broadcasting.
Unsubscribes streams from the named broadcasting.
stream_for(broadcastables, callback = nil, coder: nil, &block)Start streaming the pubsub queue for the broadcastables in this channel. Optionally, you can pass a callback that’ll be used instead of the default of just transmitting the updates straight to the subscriber.
Start streaming the pubsub queue for the broadcastables in this channel. Optionally, you can pass a callback that’ll be used instead of the default of just transmitting the updates straight to the subscriber.
Pass coder: ActiveSupport::JSON to decode messages as JSON before passing to the callback. Defaults to coder: nil which does no decoding, passes raw messages.
stream_from(broadcasting, callback = nil, coder: nil, &block)Start streaming from the named broadcasting pubsub queue. Optionally, you can pass a callback that’ll be used instead of the default of just transmitting the updates straight to the subscriber. Pass coder: ActiveSupport::JSON to decode messages as JSON before passing to the callback. Defaults to coder: nil which does no decoding, passes raw messages.
Start streaming from the named broadcasting pubsub queue. Optionally, you can pass a callback that’ll be used instead of the default of just transmitting the updates straight to the subscriber. Pass coder: ActiveSupport::JSON to decode messages as JSON before passing to the callback. Defaults to coder: nil which does no decoding, passes raw messages.
stream_or_reject_for(model)Calls stream_for with the given model if it’s present to start streaming, otherwise rejects the subscription.
Calls stream_for with the given model if it’s present to start streaming, otherwise rejects the subscription.
assert_broadcast_on(stream_or_object, *args)assert_broadcasts(stream_or_object, *args)Enhance TestHelper assertions to handle non-String broadcastings
Enhance TestHelper assertions to handle non-String broadcastings
assert_has_no_stream(stream)Asserts that the specified stream has not been started.
+Asserts that the specified stream has not been started.
def test_assert_no_started_stream
subscribe
assert_has_no_stream 'messages'
end
- assert_has_no_stream_for(object)Asserts that the specified stream for a model has not started.
+Asserts that the specified stream for a model has not started.
def test_assert_no_started_stream_for
subscribe id: 41
assert_has_no_stream_for User.find(42)
end
- assert_has_stream(stream)Asserts that the specified stream has been started.
+Asserts that the specified stream has been started.
def test_assert_started_stream
subscribe
assert_has_stream 'messages'
end
- assert_has_stream_for(object)Asserts that the specified stream for a model has started.
+Asserts that the specified stream for a model has started.
def test_assert_started_stream_for
subscribe id: 42
assert_has_stream_for User.find(42)
end
- assert_no_streams()Asserts that no streams have been started.
+Asserts that no streams have been started.
def test_assert_no_started_stream
subscribe
assert_no_streams
end
- perform(action, data = {})Perform action on a channel.
+Perform action on a channel.
NOTE: Must be subscribed.
-stub_connection(identifiers = {})Set up test connection with the specified identifiers:
+Set up test connection with the specified identifiers:
class ApplicationCable < ActionCable::Connection::Base
identified_by :user, :token
@@ -501,8 +446,7 @@
stub_connection(user: users[:john], token: 'my-secret-token')
- subscribe(params = {})Subscribe to the channel under test. Optionally pass subscription parameters as a Hash.
Subscribe to the channel under test. Optionally pass subscription parameters as a Hash.
transmissions()Returns messages transmitted into channel
-Returns messages transmitted into channel
+unsubscribe()Unsubscribe the subscription under test.
-Unsubscribe the subscription under test.
+channel_class()determine_default_channel(name)tests(channel)assert_reject_connection(&block)Asserts that the connection is rejected (via reject_unauthorized_connection).
Asserts that the connection is rejected (via reject_unauthorized_connection).
# Asserts that connection without user_id fails
assert_reject_connection { connect params: { user_id: '' } }
- reject_unauthorized_connection()Closes the WebSocket connection if it is open and returns an “unauthorized” reason.
-Closes the WebSocket connection if it is open and returns an “unauthorized” reason.
+new(server, env, coder: ActiveSupport::JSON)beat()close(reason: nil, reconnect: true)Close the WebSocket connection.
-Close the WebSocket connection.
+handle_channel_command(payload)send_async(method, *arguments)Invoke a method on the connection asynchronously through the pool of thread workers.
-Invoke a method on the connection asynchronously through the pool of thread workers.
+statistics()Return a basic hash of statistics for the connection keyed with identifier, started_at, subscriptions, and request_id. This can be returned by a health check against the connection.
Return a basic hash of statistics for the connection keyed with identifier, started_at, subscriptions, and request_id. This can be returned by a health check against the connection.
cookies()The cookies of the request that initiated the WebSocket connection. Useful for performing authorization checks.
-The cookies of the request that initiated the WebSocket connection. Useful for performing authorization checks.
+request()The request that initiated the WebSocket connection is available here. This gives access to the environment, cookies, etc.
-The request that initiated the WebSocket connection is available here. This gives access to the environment, cookies, etc.
+after_command(*methods, &block)around_command(*methods, &block)before_command(*methods, &block)connection_identifier()Return a single connection identifier that combines the value of all the registered identifiers into a single gid.
-Return a single connection identifier that combines the value of all the registered identifiers into a single gid.
+identified_by(*identifiers)Mark a key as being a connection identifier index that can then be used to find the specific connection again later. Common identifiers are current_user and current_account, but could be anything, really.
+Mark a key as being a connection identifier index that can then be used to find the specific connection again later. Common identifiers are current_user and current_account, but could be anything, really.
Note that anything marked as an identifier will automatically create a delegate by the same name on any channel instances created off the connection.
-new(name)new()attach(io, stream)detach(io, stream)post(task = nil, &block)stop()timer(interval, &block)writes_pending(io)new(logger, tags:)add_tags(*tags)tag(logger, &block)log(type, message, &block)connect(path = ActionCable.server.config.mount_path, **request_params)Performs connection attempt to exert connect on the connection under test.
cookies()disconnect()Exert disconnect on the connection under test.
Exert disconnect on the connection under test.
connection_class()determine_default_connection(name)tests(connection)new(request)encrypted()signed()action_cable_meta_tag()Returns an “action-cable-url” meta tag with the value of the URL specified in your configuration. Ensure this is above your JavaScript tag:
+Returns an “action-cable-url” meta tag with the value of the URL specified in your configuration. Ensure this is above your JavaScript tag:
<head>
<%= action_cable_meta_tag %>
@@ -92,8 +87,7 @@
<%= action_cable_meta_tag %> would render:
=> <meta name="action-cable-url" content="ws://actioncable.com" />
- new(server)where(identifier)new(server, ids)disconnect(reconnect: true)Uses the internal channel to disconnect the connection.
-Uses the internal channel to disconnect the connection.
+logger()new(config: self.class.config)call(env)Called by Rack to set up the server.
-Called by Rack to set up the server.
+connection_identifiers()All of the identifiers applied to the connection class associated with this server.
-All of the identifiers applied to the connection class associated with this server.
+disconnect(identifiers)Disconnect all the connections identified by identifiers on this server or any others via RemoteConnections.
Disconnect all the connections identified by identifiers on this server or any others via RemoteConnections.
event_loop()pubsub()Adapter used for all streams/broadcasting.
-Adapter used for all streams/broadcasting.
+remote_connections()Gateway to RemoteConnections. See that class for details.
Gateway to RemoteConnections. See that class for details.
restart()worker_pool()The worker pool is where we run connection callbacks and channel actions. We do as little as possible on the server’s main thread. The worker pool is an executor service that’s backed by a pool of threads working from a task queue. The thread pool size maxes out at 4 worker threads by default. Tune the size yourself with config.action_cable.worker_pool_size.
The worker pool is where we run connection callbacks and channel actions. We do as little as possible on the server’s main thread. The worker pool is an executor service that’s backed by a pool of threads working from a task queue. The thread pool size maxes out at 4 worker threads by default. Tune the size yourself with config.action_cable.worker_pool_size.
Using Active Record, Redis, etc within your channel actions means you’ll get a separate connection from each thread in the worker pool. Plan your deployment accordingly: 5 servers each running 5 Puma workers each running an 8-thread worker pool means at least 200 database connections.
Also, ensure that your database connection pool size is as least as large as your worker pool size. Otherwise, workers may oversubscribe the database connection pool and block while they wait for other workers to release their connections. Use a smaller worker pool or a larger database connection pool instead.
-broadcast(broadcasting, message, coder: ActiveSupport::JSON)Broadcast a hash directly to a named broadcasting. This will later be JSON encoded.
Broadcast a hash directly to a named broadcasting. This will later be JSON encoded.
broadcaster_for(broadcasting, coder: ActiveSupport::JSON)Returns a broadcaster for a named broadcasting that can be reused. Useful when you have an object that may need multiple spots to transmit to a specific broadcasting over and over.
Returns a broadcaster for a named broadcasting that can be reused. Useful when you have an object that may need multiple spots to transmit to a specific broadcasting over and over.
new(server, broadcasting, coder:)broadcast(message)new()pubsub_adapter()Returns constant of subscription adapter specified in config/cable.yml. If the adapter cannot be found, this will default to the Redis adapter. Also makes sure proper dependencies are required.
-Returns constant of subscription adapter specified in config/cable.yml. If the adapter cannot be found, this will default to the Redis adapter. Also makes sure proper dependencies are required.
+with_database_connections(&block)new(event_loop)add_subscriber(*)invoke_callback(*)new(server)broadcast(channel, payload)identifier()shutdown()subscribe(channel, message_callback, success_callback = nil)unsubscribe(channel, message_callback)new(adapter, event_loop)add_channel(channel, on_success)invoke_callback(*)listen()remove_channel(channel)shutdown()new(adapter, config_options, event_loop)add_channel(channel, on_success)invoke_callback(*)listen(conn)remove_channel(channel)shutdown()new(raw_client)subscribe(*channel)unsubscribe(*channel)new()add_channel(channel, on_success)add_subscriber(channel, subscriber, on_success)broadcast(channel, message)invoke_callback(callback, message)remove_channel(channel)remove_subscriber(channel, subscriber)broadcast(channel, payload)broadcasts(channel)clear()clear_messages(channel)assert_broadcast_on(stream, data, &block)Asserts that the specified message has been sent to the stream.
+Asserts that the specified message has been sent to the stream.
def test_assert_transmitted_message
ActionCable.server.broadcast 'messages', text: 'hello'
@@ -100,8 +95,7 @@
end
end
- assert_broadcasts(stream, number, &block)Asserts that the number of broadcasted messages to the stream matches the given number.
+Asserts that the number of broadcasted messages to the stream matches the given number.
def test_broadcasts
assert_broadcasts 'messages', 0
@@ -180,8 +169,7 @@
end
end
- assert_no_broadcasts(stream, &block)Asserts that no messages have been sent to the stream.
+Asserts that no messages have been sent to the stream.
def test_no_broadcasts
assert_no_broadcasts 'messages'
@@ -244,8 +227,7 @@
assert_broadcasts 'messages', 0, &block
-
capture_broadcasts(stream, &block)Returns the messages that are broadcasted in the block.
+Returns the messages that are broadcasted in the block.
def test_broadcasts
messages = capture_broadcasts('messages') do
@@ -290,8 +267,7 @@
assert_equal({ text: 'how are you?' }, messages.last)
end
- add_renderer(key, &block)See Renderers.add
See Renderers.add
remove_renderer(key)See Renderers.remove
See Renderers.remove
without_modules(*modules)Shortcut helper that returns all the ActionController::API modules except the ones passed as arguments:
Shortcut helper that returns all the ActionController::API modules except the ones passed as arguments:
class MyAPIBaseController < ActionController::Metal
ActionController::API.without_modules(:UrlFor).each do |left|
@@ -191,8 +186,7 @@
This gives better control over what you want to exclude and makes it easier to create an API controller class, instead of listing the modules required manually.
allow_browser(versions:, block: -> { render file: Rails.root.join("public/406-unsupported-browser.html"), layout: false, status: :not_acceptable }Specify the browser versions that will be allowed to access all actions (or some, as limited by only: or except:). Only browsers matched in the hash or named set passed to versions: will be blocked if they’re below the versions specified. This means that all other browsers, as well as agents that aren’t reporting a user-agent header, will be allowed access.
Specify the browser versions that will be allowed to access all actions (or some, as limited by only: or except:). Only browsers matched in the hash or named set passed to versions: will be blocked if they’re below the versions specified. This means that all other browsers, as well as agents that aren’t reporting a user-agent header, will be allowed access.
A browser that’s blocked will by default be served the file in public/406-unsupported-browser.html with an HTTP status code of “406 Not Acceptable”.
@@ -103,8 +98,7 @@render_to_body(options = {})without_modules(*modules)Shortcut helper that returns all the modules included in ActionController::Base except the ones passed as arguments:
Shortcut helper that returns all the modules included in ActionController::Base except the ones passed as arguments:
class MyBaseController < ActionController::Metal
ActionController::Base.without_modules(:ParamsWrapper, :Streaming).each do |left|
@@ -297,8 +292,7 @@
This gives better control over what you want to exclude and makes it easier to create a bare controller class, instead of listing the modules required manually.
-expires_in(seconds, options = {})Sets the Cache-Control header, overwriting existing directives. This method will also ensure an HTTP Date header for client compatibility.
Sets the Cache-Control header, overwriting existing directives. This method will also ensure an HTTP Date header for client compatibility.
Defaults to issuing the private directive, so that intermediate caches must not cache the response.
expires_now()Sets an HTTP 1.1 Cache-Control header of no-cache. This means the resource will be marked as stale, so clients must always revalidate. Intermediate/browser caches may still store the asset.
Sets an HTTP 1.1 Cache-Control header of no-cache. This means the resource will be marked as stale, so clients must always revalidate. Intermediate/browser caches may still store the asset.
fresh_when(object = nil, etag: nil, weak_etag: nil, strong_etag: nil, last_modified: nil, public: false, cache_control: {}, template: nil)Sets the etag, last_modified, or both on the response, and renders a 304 Not Modified response if the request is already fresh.
Sets the etag, last_modified, or both on the response, and renders a 304 Not Modified response if the request is already fresh.
:etagbefore_action { fresh_when @article, template: "widgets/show" }
- http_cache_forever(public: false)Cache or yield the block. The cache is supposed to never expire.
+Cache or yield the block. The cache is supposed to never expire.
You can use this method when you have an HTTP response that never changes, and the browser and proxies should cache it indefinitely.
public: By default, HTTP responses are private, cached only on the user’s web browser. To allow proxies to cache the response, set true to indicate that they can serve the cached response to all users.
must_understand()Adds the must-understand directive to the Cache-Control header, which indicates that a cache MUST understand the semantics of the response status code that has been received, or discard the response.
Adds the must-understand directive to the Cache-Control header, which indicates that a cache MUST understand the semantics of the response status code that has been received, or discard the response.
This is particularly useful when returning responses with new or uncommon status codes that might not be properly interpreted by older caches.
@@ -427,8 +398,7 @@no_store()Sets an HTTP 1.1 Cache-Control header of no-store. This means the resource may not be stored in any cache.
Sets an HTTP 1.1 Cache-Control header of no-store. This means the resource may not be stored in any cache.
stale?(object = nil, **freshness_kwargs)Sets the etag and/or last_modified on the response and checks them against the request. If the request doesn’t match the provided options, it is considered stale, and the response should be rendered from scratch. Otherwise, it is fresh, and a 304 Not Modified is sent.
Sets the etag and/or last_modified on the response and checks them against the request. If the request doesn’t match the provided options, it is considered stale, and the response should be rendered from scratch. Otherwise, it is fresh, and a 304 Not Modified is sent.
etag(&etagger)Allows you to consider additional controller-wide information when generating an ETag. For example, if you serve pages tailored depending on who’s logged in at the moment, you may want to add the current user id to be part of the ETag to prevent unauthorized displaying of cached pages.
+Allows you to consider additional controller-wide information when generating an ETag. For example, if you serve pages tailored depending on who’s logged in at the moment, you may want to add the current user id to be part of the ETag to prevent unauthorized displaying of cached pages.
class InvoicesController < ApplicationController
etag { current_user&.id }
@@ -78,8 +73,7 @@
end
end
- content_security_policy(enabled = true, **options, &block)Overrides parts of the globally configured Content-Security-Policy header:
Overrides parts of the globally configured Content-Security-Policy header:
class PostsController < ApplicationController
content_security_policy do |policy|
@@ -94,8 +89,7 @@
content_security_policy false, only: :index
end
- content_security_policy_report_only(report_only = true, **options)Overrides the globally configured Content-Security-Policy-Report-Only header:
Overrides the globally configured Content-Security-Policy-Report-Only header:
class PostsController < ApplicationController
content_security_policy_report_only only: :index
@@ -151,8 +140,7 @@
content_security_policy_report_only false, only: :index
end
- cookies()The cookies for the current request. See ActionDispatch::Cookies for more information.
The cookies for the current request. See ActionDispatch::Cookies for more information.
send_data(data, options = {})Sends the given binary data to the browser. This method is similar to render plain: data, but also allows you to specify whether the browser should display the response as a file attachment (i.e. in a download dialog) or as inline data. You may also set the content type, the file name, and other things.
Sends the given binary data to the browser. This method is similar to render plain: data, but also allows you to specify whether the browser should display the response as a file attachment (i.e. in a download dialog) or as inline data. You may also set the content type, the file name, and other things.
See send_file for more information on HTTP Content-* headers and caching.
send_file(path, options = {})Sends the file. This uses a server-appropriate method (such as X-Sendfile) via the Rack::Sendfile middleware. The header to use is set via config.action_dispatch.x_sendfile_header. Your server can also configure this for you by setting the X-Sendfile-Type header.
Sends the file. This uses a server-appropriate method (such as X-Sendfile) via the Rack::Sendfile middleware. The header to use is set via config.action_dispatch.x_sendfile_header. Your server can also configure this for you by setting the X-Sendfile-Type header.
Be careful to sanitize the path parameter if it is coming from a web page. send_file(params[:path]) allows a malicious user to download any file on your server.
You can use other Content-* HTTP headers to provide additional information to the client. See MDN for a list of HTTP headers.
Also be aware that the document may be cached by proxies and browsers. The Pragma and Cache-Control headers declare how the file may be cached by intermediaries. They default to require clients to validate with the server before releasing cached responses. See www.mnot.net/cache_docs/ for an overview of web caching and RFC 9111 for the Cache-Control header spec.
make_response!(request)redirect_to(options = {}, response_options_and_flash = {})add_flash_types(*types)Creates new flash types. You can pass as many types as you want to create flash types other than the default alert and notice in your controllers and views. For instance:
Creates new flash types. You can pass as many types as you want to create flash types other than the default alert and notice in your controllers and views. For instance:
# in application_controller.rb
class ApplicationController < ActionController::Base
@@ -81,8 +76,7 @@
This method will automatically define a new method for each of the given names, and it will be available in your views.
-default_form_builder()Default form builder for the controller
-Default form builder for the controller
+default_form_builder(builder)Set the form builder to be used as the default for all forms in the views rendered by this controller and its subclasses.
+Set the form builder to be used as the default for all forms in the views rendered by this controller and its subclasses.
Parametersbuilder - Default form builder. Accepts a subclass of ActionView::Helpers::FormBuilder
head(status, options = nil)Returns a response that has no content (merely headers). The options argument is interpreted to be a hash of header names and values. This allows you to easily return a response that consists only of significant headers:
+Returns a response that has no content (merely headers). The options argument is interpreted to be a hash of header names and values. This allows you to easily return a response that consists only of significant headers:
head :created, location: person_path(@person)
@@ -81,8 +76,7 @@
See Rack::Utils::SYMBOL_TO_STATUS_CODE for a full list of valid status symbols.
helpers()Provides a proxy to access helper methods from outside the view.
-Provides a proxy to access helper methods from outside the view.
+helper_attr(*attrs)Declares helper accessors for controller attributes. For example, the following adds new name and name= instance methods to a controller and makes them available to the view: attr_accessor :name helper_attr :name
Declares helper accessors for controller attributes. For example, the following adds new name and name= instance methods to a controller and makes them available to the view: attr_accessor :name helper_attr :name
Parametersattrs - Names of attributes to be converted into helpers.
helpers()Provides a proxy to access helper methods from outside the view.
+Provides a proxy to access helper methods from outside the view.
Note that the proxy is rendered under a different view context. This may cause incorrect behavior with capture methods. Consider using helper instead when using capture.
modules_for_helpers(args)Override modules_for_helpers to accept :all as argument, which loads all helpers in helpers_path.
Override modules_for_helpers to accept :all as argument, which loads all helpers in helpers_path.
Parametersarray - A normalized list of modules for the list of helpers provided.
auth_param(request)auth_scheme(request)authenticate(request, &login_procedure)authentication_request(controller, realm, message)decode_credentials(request)encode_credentials(user_name, password)has_basic_credentials?(request)user_name_and_password(request)authenticate_or_request_with_http_basic(realm = nil, message = nil, &login_procedure)authenticate_with_http_basic(&login_procedure)http_basic_authenticate_or_request_with(name:, password:, realm: nil, message: nil)request_http_basic_authentication(realm = "Application", message = nil)http_basic_authenticate_with(name:, password:, realm: nil, **options)Enables HTTP Basic authentication.
Enables HTTP Basic authentication.
See ActionController::HttpAuthentication::Basic for example usage.
authenticate(request, realm, &password_procedure)Returns true on a valid response, false otherwise.
-Returns true on a valid response, false otherwise.
+authentication_header(controller, realm)authentication_request(controller, realm, message = nil)decode_credentials(header)decode_credentials_header(request)encode_credentials(http_method, credentials, password, password_is_ha1)expected_response(http_method, uri, credentials, password, password_is_ha1 = true)Returns the expected response for a request of http_method to uri with the decoded credentials and the expected password Optional parameter password_is_ha1 is set to true by default, since best practice is to store ha1 digest instead of a plain-text password.
Returns the expected response for a request of http_method to uri with the decoded credentials and the expected password Optional parameter password_is_ha1 is set to true by default, since best practice is to store ha1 digest instead of a plain-text password.
ha1(credentials, password)nonce(secret_key, time = Time.now)Uses an MD5 digest based on time to generate a value to be used only once.
+Uses an MD5 digest based on time to generate a value to be used only once.
A server-specified data string which should be uniquely generated each time a 401 response is made. It is recommended that this string be base64 or hexadecimal data. Specifically, since the string is passed in the header lines as a quoted string, the double-quote character is not allowed.
@@ -474,8 +409,7 @@An implementation might choose not to accept a previously used nonce or a previously used digest, in order to protect against a replay attack. Or, an implementation might choose to use one-time nonces or digests for POST, PUT, or PATCH requests, and a time-stamp for GET requests. For more details on the issues involved see Section 4 of this document.
The nonce is opaque to the client. Composed of Time, and hash of Time with secret key from the Rails session secret generated upon creation of project. Ensures the time cannot be modified by client.
opaque(secret_key)Opaque based on digest of secret key
-Opaque based on digest of secret key
+secret_token(request)validate_digest_response(request, realm, &password_procedure)Returns false unless the request credentials response value matches the expected value. First try the password as a ha1 digest password. If this fails, then try it as a plain text password.
-Returns false unless the request credentials response value matches the expected value. First try the password as a ha1 digest password. If this fails, then try it as a plain text password.
+validate_nonce(secret_key, request, value, seconds_to_timeout = 5 * 60)Might want a shorter timeout depending on whether the request is a PATCH, PUT, or POST, and if the client is a browser or web service. Can be much shorter if the Stale directive is implemented. This would allow a user to use new nonce without prompting the user again for their username and password.
-Might want a shorter timeout depending on whether the request is a PATCH, PUT, or POST, and if the client is a browser or web service. Can be much shorter if the Stale directive is implemented. This would allow a user to use new nonce without prompting the user again for their username and password.
+authenticate_or_request_with_http_digest(realm = "Application", message = nil, &password_procedure)Authenticate using an HTTP Digest, or otherwise render an HTTP header requesting the client to send a Digest.
Authenticate using an HTTP Digest, or otherwise render an HTTP header requesting the client to send a Digest.
See ActionController::HttpAuthentication::Digest for example usage.
authenticate_with_http_digest(realm = "Application", &password_procedure)Authenticate using an HTTP Digest. Returns true if authentication is successful, false otherwise.
Authenticate using an HTTP Digest. Returns true if authentication is successful, false otherwise.
request_http_digest_authentication(realm = "Application", message = nil)Render an HTTP header requesting the client to send a Digest for authentication.
Render an HTTP header requesting the client to send a Digest for authentication.
authenticate(controller, &login_procedure)If token Authorization header is present, call the login procedure with the present token and options.
+If token Authorization header is present, call the login procedure with the present token and options.
Returns the return value of login_procedure if a token is found. Returns nil if no token is found.
authenticate(controller) { |token, options| ... }
- authentication_request(controller, realm, message = nil)Sets a WWW-Authenticate header to let the client know a token is desired.
+Sets a WWW-Authenticate header to let the client know a token is desired.
Returns nothing.
@@ -271,8 +260,7 @@String realm to use in the header.
- encode_credentials(token, options = {})Encodes the given token and options into an Authorization header value.
+ - +params_array_from(raw_params)Takes raw_params and turns it into an array of parameters.
Takes raw_params and turns it into an array of parameters.
raw_params(auth)This method takes an authorization body and splits up the key-value pairs by the standardized :, ;, or \t delimiters defined in AUTHN_PAIR_DELIMITERS.
This method takes an authorization body and splits up the key-value pairs by the standardized :, ;, or \t delimiters defined in AUTHN_PAIR_DELIMITERS.
rewrite_param_values(array_params)This removes the " characters wrapping the value.
This removes the " characters wrapping the value.
token_and_options(request)Parses the token and options out of the token Authorization header. The value for the Authorization header is expected to have the prefix "Token" or "Bearer". If the header looks like this:
Parses the token and options out of the token Authorization header. The value for the Authorization header is expected to have the prefix "Token" or "Bearer". If the header looks like this:
Authorization: Token token="abc", nonce="def"
@@ -479,8 +438,7 @@ ActionDispatch::Request instance with the current headers.
- token_params_from(auth)authenticate_or_request_with_http_token(realm = "Application", message = nil, &login_procedure)Authenticate using an HTTP Bearer token, or otherwise render an HTTP header requesting the client to send a Bearer token. For the authentication to be considered successful, login_procedure must not return a false value. Typically, the authenticated user is returned.
Authenticate using an HTTP Bearer token, or otherwise render an HTTP header requesting the client to send a Bearer token. For the authentication to be considered successful, login_procedure must not return a false value. Typically, the authenticated user is returned.
See ActionController::HttpAuthentication::Token for example usage.
authenticate_with_http_token(&login_procedure)Authenticate using an HTTP Bearer token. Returns the return value of login_procedure if a token is found. Returns nil if no token is found.
Authenticate using an HTTP Bearer token. Returns the return value of login_procedure if a token is found. Returns nil if no token is found.
See ActionController::HttpAuthentication::Token for example usage.
request_http_token_authentication(realm = "Application", message = nil)Render an HTTP header requesting the client to send a Bearer token for authentication.
-Render an HTTP header requesting the client to send a Bearer token for authentication.
+redirect_to(*)render(*)send_data(data, options = {})send_file(path, options = {})append_info_to_payload(payload)Every time after an action is processed, this method is invoked with the payload, so you can add more information.
-Every time after an action is processed, this method is invoked with the payload, so you can add more information.
+cleanup_view_runtime()A hook which allows you to clean up any time, wrongly taken into account in views, like database querying time.
+A hook which allows you to clean up any time, wrongly taken into account in views, like database querying time.
def cleanup_view_runtime
super - time_taken_in_something_expensive
end
- live_thread_pool_executor()process(name)response_body=(body)send_stream(filename:, disposition: "attachment", type: nil)Sends a stream to the browser, which is helpful when you’re generating exports or other running data where you don’t want the entire file buffered in memory first. Similar to send_data, but where the data is generated live.
+Sends a stream to the browser, which is helpful when you’re generating exports or other running data where you don’t want the entire file buffered in memory first. Similar to send_data, but where the data is generated live.
make_response!(request)new(stream, options = {})close()write(object, options = {})log_at(level, **options)Set a different log level per request.
+Set a different log level per request.
# Use the debug log level if a particular cookie is set.
class ApplicationController < ActionController::Base
log_at :debug, if: -> { cookies[:debug] }
end
- action(name)Returns a Rack endpoint for the given action name.
-Returns a Rack endpoint for the given action name.
+controller_name()Returns the last part of the controller’s name, underscored, without the ending Controller. For instance, PostsController returns posts. Namespaces are left out, so Admin::PostsController returns posts as well.
Returns the last part of the controller’s name, underscored, without the ending Controller. For instance, PostsController returns posts. Namespaces are left out, so Admin::PostsController returns posts as well.
string
dispatch(name, req, res)Direct dispatch to the controller. Instantiates the controller, then executes the action named name.
Direct dispatch to the controller. Instantiates the controller, then executes the action named name.
make_response!(request)middleware()The middleware stack used by this controller.
+The middleware stack used by this controller.
By default uses a variation of ActionDispatch::MiddlewareStack which allows for the following syntax:
Read more about [Rails middleware stack] (guides.rubyonrails.org/rails_on_rack.html#action-dispatcher-middleware-stack) in the guides.
-new()use(...)Pushes the given Rack middleware and its arguments to the bottom of the middleware stack.
-Pushes the given Rack middleware and its arguments to the bottom of the middleware stack.
+content_typeDelegates to ActionDispatch::Response#content_type
Delegates to ActionDispatch::Response#content_type
content_type=Delegates to ActionDispatch::Response#content_type=
Delegates to ActionDispatch::Response#content_type=
controller_name()Delegates to the class’s ::controller_name.
Delegates to the class’s ::controller_name.
headersDelegates to ActionDispatch::Response#headers.
Delegates to ActionDispatch::Response#headers.
locationDelegates to ActionDispatch::Response#location
Delegates to ActionDispatch::Response#location
location=Delegates to ActionDispatch::Response#location=
Delegates to ActionDispatch::Response#location=
media_typeDelegates to ActionDispatch::Response#media_type
Delegates to ActionDispatch::Response#media_type
params()params=(val)performed?()Tests if render or redirect has already happened.
-Tests if render or redirect has already happened.
+reset_session()response=(response)Assign the response and mark it as committed. No further processing will occur.
-Assign the response and mark it as committed. No further processing will occur.
+response_body=(body)sessionThe ActionDispatch::Request::Session instance for the current request. See further details in the Active Controller Session guide.
-The ActionDispatch::Request::Session instance for the current request. See further details in the Active Controller Session guide.
+statusDelegates to ActionDispatch::Response#status
Delegates to ActionDispatch::Response#status
status=Delegates to ActionDispatch::Response#status=
Delegates to ActionDispatch::Response#status=
url_for(string)Basic url_for that can be overridden for more robust functionality.
Basic url_for that can be overridden for more robust functionality.
respond_to(*mimes)Without web-service support, an action which collects the data for displaying a list of people might look something like this:
+Without web-service support, an action which collects the data for displaying a list of people might look something like this:
def index
@people = Person.all
@@ -277,8 +272,7 @@
format.html.phone # this gets rendered
end
- new(mimes, variant = nil)all(*args, &block)
+ Alias for:
+ any.
+
any(*args, &block)
+ Also aliased as:
+
+ all.
+
any_response?()custom(mime_type, &block)negotiate_format(request)response()new(format)param_encoding(action, param, encoding)Specify the encoding for a parameter on an action. If not specified the default is UTF-8.
+Specify the encoding for a parameter on an action. If not specified the default is UTF-8.
You can specify a binary (ASCII_8BIT) parameter with:
@@ -92,8 +87,7 @@The file_path parameter on the show action would be encoded as ASCII-8BIT, but all other arguments will remain UTF-8 encoded. This is useful in the case where an application must handle data but encoding of the data is unknown, like file system data.
-skip_parameter_encoding(action)Specify that a given action’s parameters should all be encoded as ASCII-8BIT (it “skips” the encoding default of UTF-8).
+Specify that a given action’s parameters should all be encoded as ASCII-8BIT (it “skips” the encoding default of UTF-8).
For example, a controller would use it like this:
@@ -148,8 +137,7 @@The show action in the above controller would have all parameter values encoded as ASCII-8BIT. This is useful in the case where an application must handle data but encoding of the data is unknown, like file system data.
-new(parameters = {}, logging_context = {})Returns a new ActionController::Parameters instance. Also, sets the permitted attribute to the default value of ActionController::Parameters.permit_all_parameters.
Returns a new ActionController::Parameters instance. Also, sets the permitted attribute to the default value of ActionController::Parameters.permit_all_parameters.
class Person < ActiveRecord::Base
end
@@ -518,8 +513,7 @@
params.permitted? # => true
Person.new(params) # => #<Person id: nil, name: "Francesco">
- ==(other)Returns true if another Parameters object contains the same content and permitted flag.
Returns true if another Parameters object contains the same content and permitted flag.
[](key)Returns a parameter for the given key. If not found, returns nil.
Returns a parameter for the given key. If not found, returns nil.
params = ActionController::Parameters.new(person: { name: "Francesco" })
params[:person] # => #<ActionController::Parameters {"name"=>"Francesco"} permitted: false>
params[:none] # => nil
- []=(key, value)Assigns a value to a given key. The given key may still get filtered out when permit is called.
Assigns a value to a given key. The given key may still get filtered out when permit is called.
as_json(options=nil)
+Returns a hash that can be used as the JSON representation for the parameters.
-Returns a hash that can be used as the JSON representation for the parameters.
+compact()Returns a new ActionController::Parameters instance with nil values removed.
Returns a new ActionController::Parameters instance with nil values removed.
compact!()Removes all nil values in place and returns self, or nil if no changes were made.
Removes all nil values in place and returns self, or nil if no changes were made.
compact_blank()Returns a new ActionController::Parameters instance without the blank values. Uses Object#blank? for determining if a value is blank.
Returns a new ActionController::Parameters instance without the blank values. Uses Object#blank? for determining if a value is blank.
compact_blank!()Removes all blank values in place and returns self. Uses Object#blank? for determining if a value is blank.
Removes all blank values in place and returns self. Uses Object#blank? for determining if a value is blank.
converted_arrays()Attribute that keeps track of converted arrays, if any, to avoid double looping in the common use case permit + mass-assignment. Defined in a method to instantiate it only if needed.
+Attribute that keeps track of converted arrays, if any, to avoid double looping in the common use case permit + mass-assignment. Defined in a method to instantiate it only if needed.
Testing membership still loops, but it’s going to be faster than our own loop that converts values. Also, we are not going to build a new array object per fetch.
deep_dup()Returns a duplicate ActionController::Parameters instance with the same permitted parameters.
Returns a duplicate ActionController::Parameters instance with the same permitted parameters.
deep_merge(other_hash, &block)
+Returns a new ActionController::Parameters instance with self and other_hash merged recursively.
Returns a new ActionController::Parameters instance with self and other_hash merged recursively.
Like with Hash#merge in the standard library, a block can be provided to merge values.
deep_merge!(other_hash, &block)
+Same as deep_merge, but modifies self.
Same as deep_merge, but modifies self.
deep_transform_keys(&block)Returns a new ActionController::Parameters instance with the results of running block once for every key. This includes the keys from the root hash and from all nested hashes and arrays. The values are unchanged.
Returns a new ActionController::Parameters instance with the results of running block once for every key. This includes the keys from the root hash and from all nested hashes and arrays. The values are unchanged.
deep_transform_keys!(&block)Returns the same ActionController::Parameters instance with changed keys. This includes the keys from the root hash and from all nested hashes and arrays. The values are unchanged.
Returns the same ActionController::Parameters instance with changed keys. This includes the keys from the root hash and from all nested hashes and arrays. The values are unchanged.
delete(key, &block)Deletes a key-value pair from Parameters and returns the value. If key is not found, returns nil (or, with optional code block, yields key and returns the result). This method is similar to extract!, which returns the corresponding ActionController::Parameters object.
Deletes a key-value pair from Parameters and returns the value. If key is not found, returns nil (or, with optional code block, yields key and returns the result). This method is similar to extract!, which returns the corresponding ActionController::Parameters object.
delete_if(&block)
+ Alias for:
+ reject!.
+
dig(*keys)Extracts the nested parameter from the given keys by calling dig at each step. Returns nil if any intermediate step is nil.
Extracts the nested parameter from the given keys by calling dig at each step. Returns nil if any intermediate step is nil.
params = ActionController::Parameters.new(foo: { bar: { baz: 1 } })
params.dig(:foo, :bar, :baz) # => 1
@@ -1108,8 +1000,7 @@
params2 = ActionController::Parameters.new(foo: [10, 11, 12])
params2.dig(:foo, 1) # => 11
- each(&block)
+ Alias for:
+ each_pair.
+
each_key(&block)
+Calls block once for each key in the parameters, passing the key. If no block is given, an enumerator is returned instead.
-Calls block once for each key in the parameters, passing the key. If no block is given, an enumerator is returned instead.
+each_pair(&block)Convert all hashes in values into parameters, then yield each pair in the same way as Hash#each_pair.
Convert all hashes in values into parameters, then yield each pair in the same way as Hash#each_pair.
+ Also aliased as:
+
+ each.
+
each_value(&block)Convert all hashes in values into parameters, then yield each value in the same way as Hash#each_value.
Convert all hashes in values into parameters, then yield each value in the same way as Hash#each_value.
empty?()
+Returns true if the parameters have no key/value pairs.
-Returns true if the parameters have no key/value pairs.
+eql?(other)except(*keys)Returns a new ActionController::Parameters instance that filters out the given keys.
Returns a new ActionController::Parameters instance that filters out the given keys.
params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
params.except(:a, :b) # => #<ActionController::Parameters {"c"=>3} permitted: false>
params.except(:d) # => #<ActionController::Parameters {"a"=>1, "b"=>2, "c"=>3} permitted: false>
-
+ Also aliased as:
+
+ without.
+
exclude?(key)
+Returns true if the given key is not present in the parameters.
-Returns true if the given key is not present in the parameters.
+expect(*filters)expect is the preferred way to require and permit parameters. It is safer than the previous recommendation to call permit and require in sequence, which could allow user triggered 500 errors.
expect is the preferred way to require and permit parameters. It is safer than the previous recommendation to call permit and require in sequence, which could allow user triggered 500 errors.
expect is more strict with types to avoid a number of potential pitfalls that may be encountered with the .require.permit pattern.
expect!(*filters)Same as expect, but raises an ActionController::ExpectedParameterMissing instead of ActionController::ParameterMissing. Unlike expect which will render a 400 response, expect! will raise an exception that is not handled. This is intended for debugging invalid params for an internal API where incorrectly formatted params would indicate a bug in a client library that should be fixed.
Same as expect, but raises an ActionController::ExpectedParameterMissing instead of ActionController::ParameterMissing. Unlike expect which will render a 400 response, expect! will raise an exception that is not handled. This is intended for debugging invalid params for an internal API where incorrectly formatted params would indicate a bug in a client library that should be fixed.
extract!(*keys)Removes and returns the key/value pairs matching the given keys.
+Removes and returns the key/value pairs matching the given keys.
params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
params.extract!(:a, :b) # => #<ActionController::Parameters {"a"=>1, "b"=>2} permitted: false>
params # => #<ActionController::Parameters {"c"=>3} permitted: false>
- extract_value(key, delimiter: "_")Returns parameter value for the given key separated by delimiter.
Returns parameter value for the given key separated by delimiter.
params = ActionController::Parameters.new(id: "1_123", tags: "ruby,rails")
params.extract_value(:id) # => ["1", "123"]
@@ -1629,8 +1450,7 @@
params = ActionController::Parameters.new(tags: "ruby,rails,,web")
params.extract_value(:tags, delimiter: ",") # => ["ruby", "rails", "", "web"]
-
fetch(key, *args)Returns a parameter for the given key. If the key can’t be found, there are several options: With no other arguments, it will raise an ActionController::ParameterMissing error; if a second argument is given, then that is returned (converted to an instance of ActionController::Parameters if possible); if a block is given, then that will be run and its result returned.
Returns a parameter for the given key. If the key can’t be found, there are several options: With no other arguments, it will raise an ActionController::ParameterMissing error; if a second argument is given, then that is returned (converted to an instance of ActionController::Parameters if possible); if a block is given, then that will be run and its result returned.
params = ActionController::Parameters.new(person: { name: "Francesco" })
params.fetch(:person) # => #<ActionController::Parameters {"name"=>"Francesco"} permitted: false>
@@ -1672,8 +1487,7 @@
params.fetch(:none, "Francesco") # => "Francesco"
params.fetch(:none) { "Francesco" } # => "Francesco"
- has_key?
+ Alias for:
+ include?.
+
has_value?(value)Returns true if the given value is present for some key in the parameters.
-Returns true if the given value is present for some key in the parameters.
+
+ Also aliased as:
+
+ value?.
+
hash()include?(key)Returns true if the given key is present in the parameters.
-Returns true if the given key is present in the parameters.
+
+ Also aliased as:
+
+ has_key?, key?, member?.
+
inspect()keep_if(&block)
+ Alias for:
+ select!.
+
key?
+ Alias for:
+ include?.
+
keys()
+Returns a new array of the keys of the parameters.
-Returns a new array of the keys of the parameters.
+member?
+ Alias for:
+ include?.
+
merge(other_hash)Returns a new ActionController::Parameters instance with all keys from other_hash merged into current hash.
Returns a new ActionController::Parameters instance with all keys from other_hash merged into current hash.
merge!(other_hash)
+Returns the current ActionController::Parameters instance with other_hash merged into current hash.
Returns the current ActionController::Parameters instance with other_hash merged into current hash.
permit(*filters)Returns a new ActionController::Parameters instance that includes only the given filters and sets the permitted attribute for the object to true. This is useful for limiting which attributes should be allowed for mass updating.
Returns a new ActionController::Parameters instance that includes only the given filters and sets the permitted attribute for the object to true. This is useful for limiting which attributes should be allowed for mass updating.
params = ActionController::Parameters.new(name: "Francesco", age: 22, role: "admin")
permitted = params.permit(:name, :age)
@@ -2175,8 +1914,7 @@
params.permit(person: { '0': [:email], '1': [:phone]}).to_h
# => {"person"=>{"0"=>{"email"=>"none@test.com"}, "1"=>{"phone"=>"555-6789"}}}
- permit!()Sets the permitted attribute to true. This can be used to pass mass assignment. Returns self.
Sets the permitted attribute to true. This can be used to pass mass assignment. Returns self.
class Person < ActiveRecord::Base
end
@@ -2221,8 +1954,7 @@
params.permitted? # => true
Person.new(params) # => #<Person id: nil, name: "Francesco">
- permitted?()Returns true if the parameter is permitted, false otherwise.
Returns true if the parameter is permitted, false otherwise.
params = ActionController::Parameters.new
params.permitted? # => false
params.permit!
params.permitted? # => true
- reject(&block)Returns a new ActionController::Parameters instance with items that the block evaluates to true removed.
Returns a new ActionController::Parameters instance with items that the block evaluates to true removed.
reject!(&block)Removes items that the block evaluates to true and returns self.
-Removes items that the block evaluates to true and returns self.
+
+ Also aliased as:
+
+ delete_if.
+
require(key)This method accepts both a single key and an array of keys.
+This method accepts both a single key and an array of keys.
When passed a single key, if it exists and its associated value is either present or the singleton false, returns said value:
+ Also aliased as:
+
+ required.
+
required(key)
+ Alias for:
+ require.
+
reverse_merge(other_hash)Returns a new ActionController::Parameters instance with all keys from current hash merged into other_hash.
Returns a new ActionController::Parameters instance with all keys from current hash merged into other_hash.
+ Also aliased as:
+
+ with_defaults.
+
reverse_merge!(other_hash)Returns the current ActionController::Parameters instance with current hash merged into other_hash.
Returns the current ActionController::Parameters instance with current hash merged into other_hash.
+ Also aliased as:
+
+ with_defaults!.
+
select(&block)Returns a new ActionController::Parameters instance with only items that the block evaluates to true.
Returns a new ActionController::Parameters instance with only items that the block evaluates to true.
select!(&block)Equivalent to Hash#keep_if, but returns nil if no changes were made.
Equivalent to Hash#keep_if, but returns nil if no changes were made.
+ Also aliased as:
+
+ keep_if.
+
slice(*keys)Returns a new ActionController::Parameters instance that includes only the given keys. If the given keys don’t exist, returns an empty hash.
Returns a new ActionController::Parameters instance that includes only the given keys. If the given keys don’t exist, returns an empty hash.
params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
params.slice(:a, :b) # => #<ActionController::Parameters {"a"=>1, "b"=>2} permitted: false>
params.slice(:d) # => #<ActionController::Parameters {} permitted: false>
- slice!(*keys)Returns the current ActionController::Parameters instance which contains only the given keys.
Returns the current ActionController::Parameters instance which contains only the given keys.
to_h(&block)Returns a safe ActiveSupport::HashWithIndifferentAccess representation of the parameters with all unpermitted keys removed.
Returns a safe ActiveSupport::HashWithIndifferentAccess representation of the parameters with all unpermitted keys removed.
params = ActionController::Parameters.new({
name: "Senjougahara Hitagi",
@@ -2740,8 +2410,7 @@
safe_params = params.permit(:name)
safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}
- to_hash()Returns a safe Hash representation of the parameters with all unpermitted keys removed.
Returns a safe Hash representation of the parameters with all unpermitted keys removed.
params = ActionController::Parameters.new({
name: "Senjougahara Hitagi",
@@ -2790,8 +2454,7 @@
safe_params = params.permit(:name)
safe_params.to_hash # => {"name"=>"Senjougahara Hitagi"}
- to_param(*args)
+ Alias for:
+ to_query.
+
to_query(*args)Returns a string representation of the receiver suitable for use as a URL query string:
+Returns a string representation of the receiver suitable for use as a URL query string:
params = ActionController::Parameters.new({
name: "David",
@@ -2875,13 +2526,14 @@
The string pairs "key=value" that conform the query string are sorted lexicographically in ascending order.
+ Also aliased as:
+
+ to_param.
+
to_s()
+Returns the content of the parameters as a string.
-Returns the content of the parameters as a string.
+to_unsafe_h()Returns an unsafe, unfiltered ActiveSupport::HashWithIndifferentAccess representation of the parameters.
Returns an unsafe, unfiltered ActiveSupport::HashWithIndifferentAccess representation of the parameters.
params = ActionController::Parameters.new({
name: "Senjougahara Hitagi",
@@ -2958,13 +2599,14 @@
params.to_unsafe_h
# => {"name"=>"Senjougahara Hitagi", "oddity" => "Heavy stone crab"}
-
+ Also aliased as:
+
+ to_unsafe_hash.
+
to_unsafe_hash()
+ Alias for:
+ to_unsafe_h.
+
transform_keys(&block)Returns a new ActionController::Parameters instance with the results of running block once for every key. The values are unchanged.
Returns a new ActionController::Parameters instance with the results of running block once for every key. The values are unchanged.
transform_keys!(&block)Performs keys transformation and returns the altered ActionController::Parameters instance.
Performs keys transformation and returns the altered ActionController::Parameters instance.
transform_values()Returns a new ActionController::Parameters instance with the results of running block once for every value. The keys are unchanged.
Returns a new ActionController::Parameters instance with the results of running block once for every value. The keys are unchanged.
params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
params.transform_values { |x| x * 2 }
# => #<ActionController::Parameters {"a"=>2, "b"=>4, "c"=>6} permitted: false>
- transform_values!()Performs values transformation and returns the altered ActionController::Parameters instance.
Performs values transformation and returns the altered ActionController::Parameters instance.
value?(value)
+ Alias for:
+ has_value?.
+
values()Returns a new array of the values of the parameters.
-Returns a new array of the values of the parameters.
+values_at(*keys)Returns values that were assigned to the given keys. Note that all the Hash objects will be converted to ActionController::Parameters.
Returns values that were assigned to the given keys. Note that all the Hash objects will be converted to ActionController::Parameters.
with_defaults(other_hash)
+ Alias for:
+ reverse_merge.
+
with_defaults!(other_hash)
+ Alias for:
+ reverse_merge!.
+
without(*keys)
+ Alias for:
+ except.
+
each_nested_attribute()nested_attributes?()permit_filters(filters, on_unpermitted: nil, explicit_arrays: true)Filters self and optionally checks for unpermitted keys
-Filters self and optionally checks for unpermitted keys
+_set_wrapper_options(options)inherited(klass)Sets the default wrapper key or model which will be used to determine wrapper key and attribute names. Called automatically when the module is inherited.
-Sets the default wrapper key or model which will be used to determine wrapper key and attribute names. Called automatically when the module is inherited.
+wrap_parameters(name_or_model_or_options, options = {})Sets the name of the wrapper key, or the model which ParamsWrapper would use to determine the attribute names from.
Sets the name of the wrapper key, or the model which ParamsWrapper would use to determine the attribute names from.
:exclude - The list of attribute names which parameters wrapper will exclude from a nested hash.
- permissions_policy(**options, &block)Overrides parts of the globally configured Feature-Policy header:
Overrides parts of the globally configured Feature-Policy header:
class PagesController < ApplicationController
permissions_policy do |policy|
@@ -90,8 +85,7 @@
# policy.gyroscope :none
end
- inherited(klass)rate_limit(to:, within:, by: -> { request.remote_ip }Applies a rate limit to all actions or those specified by the normal before_action filters with only: and except:.
Applies a rate limit to all actions or those specified by the normal before_action filters with only: and except:.
The maximum number of requests allowed is specified to: and constrained to the window of time given by within:.
redirect_back(fallback_location:, allow_other_host: _allow_other_host, **args)Soft deprecated alias for redirect_back_or_to where the fallback_location location is supplied as a keyword argument instead of the first positional argument.
Soft deprecated alias for redirect_back_or_to where the fallback_location location is supplied as a keyword argument instead of the first positional argument.
redirect_back_or_to(fallback_location, allow_other_host: _allow_other_host, **options)Redirects the browser to the page that issued the request (the referrer) if possible, otherwise redirects to the provided default fallback location.
+Redirects the browser to the page that issued the request (the referrer) if possible, otherwise redirects to the provided default fallback location.
The referrer information is pulled from the HTTP Referer (sic) header on the request. This is an optional header and its presence on the request is subject to browser security settings and user preferences. If the request is missing this header, the fallback_location will be used.
All other options that can be passed to redirect_to are accepted as options, and the behavior is identical.
redirect_to(options = {}, response_options = {})Redirects the browser to the target specified in options. This parameter can be any one of:
Redirects the browser to the target specified in options. This parameter can be any one of:
Hash - The URL will be generated by calling url_for with the options.
:raise - Raises an UnsafeRedirectError
url_from(location)Verifies the passed location is an internal URL that’s safe to redirect to and returns it, or nil if not. Useful to wrap a params provided redirect URL and fall back to an alternate URL to redirect to:
Verifies the passed location is an internal URL that’s safe to redirect to and returns it, or nil if not. Useful to wrap a params provided redirect URL and fall back to an alternate URL to redirect to:
redirect_to url_from(params[:redirect_url]) || root_url
@@ -374,8 +351,7 @@ NOTE: there’s a similarity with url_for, which generates an internal URL from various options from within the app, e.g. post) at url_for(. However, url_from is meant to take an external parameter to verify as in url_from(params[:redirect_url]).
new(location)new(url)for(controller, env = nil, defaults = DEFAULTS)Creates a new renderer using the given controller class. See ::new.
Creates a new renderer using the given controller class. See ::new.
new(controller, env, defaults)Initializes a new Renderer.
Initializes a new Renderer.
ParametersParameter
If no http_host is specified, the env HTTP host will be derived from the routes’ default_url_options. In this case, the https boolean and the script_name will also be derived from default_url_options if they were not specified. Additionally, the https boolean will fall back to Rails.application.config.force_ssl if default_url_options does not specify a protocol.
Parameter
Instance Public methods
-
-
- defaults()
-
-
+ defaults()
-
-
-
-
@@ -291,20 +271,14 @@
-
-
- new(env = nil)
-
-
+ new(env = nil)
-
-
- Creates a new renderer using the same controller, but with a new Rack env.
+
+Creates a new renderer using the same controller, but with a new Rack env.
ApplicationController.renderer.new(method: "post")
-
-
+
@@ -329,17 +303,11 @@
-
-
- render(*args)
-
-
+ render(*args)
-
-
- Renders a template to a string, just like ActionController::Rendering#render_to_string.
-
-
+
+Renders a template to a string, just like ActionController::Rendering#render_to_string.
+
@@ -370,17 +338,11 @@
-
-
- with_defaults(defaults)
-
-
+ with_defaults(defaults)
-
-
- Creates a new renderer using the same controller, but with the given defaults merged on top of the previous defaults.
-
-
+
+Creates a new renderer using the same controller, but with the given defaults merged on top of the previous defaults.
+
diff --git a/src/classes/ActionController/Renderers.html b/src/classes/ActionController/Renderers.html
index 61b14ee2ad..1fc4bb9bd6 100644
--- a/src/classes/ActionController/Renderers.html
+++ b/src/classes/ActionController/Renderers.html
@@ -98,15 +98,10 @@ Constants
Class Public methods
-
-
- add(key, &block)
-
-
+ add(key, &block)
-
-
- Adds a new renderer to call within controller actions. A renderer is invoked by passing its name as an option to AbstractController::Rendering#render. To create a renderer pass it a name and a block. The block takes two arguments, the first is the value paired with its key and the second is the remaining hash of options passed to render.
+
+Adds a new renderer to call within controller actions. A renderer is invoked by passing its name as an option to AbstractController::Rendering#render. To create a renderer pass it a name and a block. The block takes two arguments, the first is the value paired with its key and the second is the remaining hash of options passed to render.
Create a csv renderer:
@@ -130,8 +125,7 @@
end
end
-
-
+
@@ -157,22 +151,16 @@
-
-
- remove(key)
-
-
+ remove(key)
-
-
- This method is the opposite of add method.
+
+This method is the opposite of add method.
To remove a csv renderer:
ActionController::Renderers.remove(:csv)
-
-
+
@@ -203,19 +191,13 @@
Instance Public methods
-
-
- render_to_body(options)
-
-
+ render_to_body(options)
-
-
- Called by render in AbstractController::Rendering which sets the return value as the response_body.
+
+Called by render in AbstractController::Rendering which sets the return value as the response_body.
If no renderer is found, super returns control to ActionView::Rendering.render_to_body, if present.
-
-
+
diff --git a/src/classes/ActionController/Renderers/ClassMethods.html b/src/classes/ActionController/Renderers/ClassMethods.html
index 0815a642f9..f89b1b98b8 100644
--- a/src/classes/ActionController/Renderers/ClassMethods.html
+++ b/src/classes/ActionController/Renderers/ClassMethods.html
@@ -62,24 +62,17 @@ Methods
Instance Public methods
-
-
- use_renderer(*args)
-
-
+ use_renderer(*args)
-
-
-
-
-
- Alias for: use_renderers
-
+
+ Alias for:
+ use_renderers.
+
@@ -87,15 +80,10 @@
-
-
- use_renderers(*args)
-
-
+ use_renderers(*args)
-
-
- Adds, by name, a renderer or renderers to the _renderers available to call within controller actions.
+
+Adds, by name, a renderer or renderers to the _renderers available to call within controller actions.
It is useful when rendering from an ActionController::Metal controller or otherwise to add an available renderer proc to a specific controller.
@@ -119,13 +107,14 @@
You must specify a use_renderer, else the controller.renderer and controller._renderers will be nil, and the action will fail.
-
-
+
-
- Also aliased as: use_renderer
-
+
+ Also aliased as:
+
+ use_renderer.
+
diff --git a/src/classes/ActionController/Rendering.html b/src/classes/ActionController/Rendering.html
index e6f1ef21fa..a99f32bb3e 100644
--- a/src/classes/ActionController/Rendering.html
+++ b/src/classes/ActionController/Rendering.html
@@ -88,15 +88,10 @@ Constants
Instance Public methods
-
-
- render(*args)
-
-
+ render(*args)
-
-
- Renders a template and assigns the result to self.response_body.
+
+Renders a template and assigns the result to self.response_body.
If no rendering mode option is specified, the template will be derived from the first argument.
@@ -249,8 +244,7 @@ Options
render "posts/index", variants: [:mobile]
# => renders app/views/posts/index.html+mobile.erb
-
-
+
@@ -276,17 +270,11 @@ Options
-
-
- render_to_string(*)
-
-
+ render_to_string(*)
-
-
- Similar to render, but only returns the rendered template as a string, instead of setting self.response_body.
-
-
+
+Similar to render, but only returns the rendered template as a string, instead of setting self.response_body.
+
diff --git a/src/classes/ActionController/Rendering/ClassMethods.html b/src/classes/ActionController/Rendering/ClassMethods.html
index 35c51b23a4..f595af50b0 100644
--- a/src/classes/ActionController/Rendering/ClassMethods.html
+++ b/src/classes/ActionController/Rendering/ClassMethods.html
@@ -72,17 +72,9 @@ Attributes
Instance Public methods
-
-
- inherited(klass)
-
-
+ inherited(klass)
-
-
-
-
diff --git a/src/classes/ActionController/RequestForgeryProtection.html b/src/classes/ActionController/RequestForgeryProtection.html
index b0f45ce91b..61c15b31cf 100644
--- a/src/classes/ActionController/RequestForgeryProtection.html
+++ b/src/classes/ActionController/RequestForgeryProtection.html
@@ -250,17 +250,9 @@ Constants
Class Public methods
-
-
- new(...)
-
-
+ new(...)
-
-
-
-
@@ -290,17 +282,9 @@
Instance Public methods
-
-
- commit_csrf_token(request)
-
-
+ commit_csrf_token(request)
-
-
-
-
@@ -326,17 +310,9 @@
-
-
- reset_csrf_token(request)
-
-
+ reset_csrf_token(request)
-
-
-
-
@@ -365,17 +341,11 @@
Instance Private methods
-
-
- any_authenticity_token_valid?()
-
-
+ any_authenticity_token_valid?()
-
-
- Checks if any of the authenticity tokens from the request are valid.
-
-
+
+Checks if any of the authenticity tokens from the request are valid.
+
@@ -402,17 +372,9 @@
-
-
- compare_with_global_token(token, session = nil)
-
-
+ compare_with_global_token(token, session = nil)
-
-
-
-
@@ -437,17 +399,9 @@
-
-
- compare_with_real_token(token, session = nil)
-
-
+ compare_with_real_token(token, session = nil)
-
-
-
-
@@ -472,17 +426,9 @@
-
-
- csrf_token_hmac(session, identifier)
-
-
+ csrf_token_hmac(session, identifier)
-
-
-
-
@@ -511,17 +457,11 @@
-
-
- form_authenticity_param()
-
-
+ form_authenticity_param()
-
-
- The form’s authenticity parameter. Override to provide your own.
-
-
+
+The form’s authenticity parameter. Override to provide your own.
+
@@ -546,17 +486,11 @@
-
-
- form_authenticity_token(form_options: {})
-
-
+ form_authenticity_token(form_options: {})
-
-
- Creates the authenticity token for the current request.
-
-
+
+Creates the authenticity token for the current request.
+
@@ -581,17 +515,9 @@
-
-
- global_csrf_token(session = nil)
-
-
+ global_csrf_token(session = nil)
-
-
-
-
@@ -616,17 +542,11 @@
-
-
- mark_for_same_origin_verification!()
-
-
+ mark_for_same_origin_verification!()
-
-
- GET requests are checked for cross-origin JavaScript after rendering.
-
-
+
+GET requests are checked for cross-origin JavaScript after rendering.
+
@@ -651,17 +571,11 @@
-
-
- marked_for_same_origin_verification?()
-
-
+ marked_for_same_origin_verification?()
-
-
- If the verify_authenticity_token before_action ran, verify that JavaScript responses are only served to same-origin GET requests.
-
-
+
+If the verify_authenticity_token before_action ran, verify that JavaScript responses are only served to same-origin GET requests.
+
@@ -686,17 +600,9 @@
-
-
- mask_token(raw_token)
-
-
+ mask_token(raw_token)
-
-
-
-
@@ -724,17 +630,11 @@
-
-
- non_xhr_javascript_response?()
-
-
+ non_xhr_javascript_response?()
-
-
- Check for cross-origin JavaScript responses.
-
-
+
+Check for cross-origin JavaScript responses.
+
@@ -759,17 +659,9 @@
-
-
- per_form_csrf_token(session, action_path, method)
-
-
+ per_form_csrf_token(session, action_path, method)
-
-
-
-
@@ -794,17 +686,11 @@
-
-
- protect_against_forgery?()
-
-
+ protect_against_forgery?()
-
-
- Checks if the controller allows forgery protection.
-
-
+
+Checks if the controller allows forgery protection.
+
@@ -829,17 +715,9 @@
-
-
- real_csrf_token(_session = nil)
-
-
+ real_csrf_token(_session = nil)
-
-
-
-
@@ -868,17 +746,11 @@
-
-
- request_authenticity_tokens()
-
-
+ request_authenticity_tokens()
-
-
- Possible authenticity tokens sent in the request.
-
-
+
+Possible authenticity tokens sent in the request.
+
@@ -903,17 +775,9 @@
-
-
- unmask_token(masked_token)
-
-
+ unmask_token(masked_token)
-
-
-
-
@@ -941,17 +805,11 @@
-
-
- valid_authenticity_token?(session, encoded_masked_token)
-
-
+ valid_authenticity_token?(session, encoded_masked_token)
-
-
- Checks the client’s masked token to see if it matches the session token. Essentially the inverse of masked_authenticity_token.
-
-
+
+Checks the client’s masked token to see if it matches the session token. Essentially the inverse of masked_authenticity_token.
+
@@ -1002,17 +860,9 @@
-
-
- valid_per_form_csrf_token?(token, session = nil)
-
-
+ valid_per_form_csrf_token?(token, session = nil)
-
-
-
-
@@ -1047,17 +897,11 @@
-
-
- valid_request_origin?()
-
-
+ valid_request_origin?()
-
-
- Checks if the request originated from the same origin by looking at the Origin header.
-
-
+
+Checks if the request originated from the same origin by looking at the Origin header.
+
@@ -1088,15 +932,10 @@
-
-
- verified_request?()
-
-
+ verified_request?()
-
-
- Returns true or false if a request is verified. Checks:
+
+Returns true or false if a request is verified. Checks:
-
Is it a GET or HEAD request? GETs should be safe and idempotent
-
@@ -1104,8 +943,7 @@
-
Does the X-CSRF-Token header match the form_authenticity_token?
-
-
+
@@ -1131,19 +969,13 @@
-
-
- verify_authenticity_token()
-
-
+ verify_authenticity_token()
-
-
- The actual before_action that is used to verify the CSRF token. Don’t override this directly. Provide your own forgery protection strategy instead. If you override, you’ll disable same-origin <script> verification.
+
+The actual before_action that is used to verify the CSRF token. Don’t override this directly. Provide your own forgery protection strategy instead. If you override, you’ll disable same-origin <script> verification.
Lean on the protect_from_forgery declaration to mark which actions are due for same-origin request verification. If protect_from_forgery is enabled on an action, this before_action flags its after_action to verify that JavaScript responses are for XHR requests, ensuring they follow the browser’s same-origin policy.
-
-
+
@@ -1174,17 +1006,11 @@
-
-
- verify_same_origin_request()
-
-
+ verify_same_origin_request()
-
-
- If verify_authenticity_token was run (indicating that we have forgery protection enabled for this request) then also verify that we aren’t serving an unauthorized cross-origin response.
-
-
+
+If verify_authenticity_token was run (indicating that we have forgery protection enabled for this request) then also verify that we aren’t serving an unauthorized cross-origin response.
+
@@ -1214,17 +1040,9 @@
-
-
- xor_byte_strings(s1, s2)
-
-
+ xor_byte_strings(s1, s2)
-
-
-
-
diff --git a/src/classes/ActionController/RequestForgeryProtection/ClassMethods.html b/src/classes/ActionController/RequestForgeryProtection/ClassMethods.html
index 79f799f60b..220ca70710 100644
--- a/src/classes/ActionController/RequestForgeryProtection/ClassMethods.html
+++ b/src/classes/ActionController/RequestForgeryProtection/ClassMethods.html
@@ -62,15 +62,10 @@ Methods
Instance Public methods
-
-
- protect_from_forgery(options = {})
-
-
+ protect_from_forgery(options = {})
-
-
- Turn on request forgery protection. Bear in mind that GET and HEAD requests are not checked.
+
+Turn on request forgery protection. Bear in mind that GET and HEAD requests are not checked.
class ApplicationController < ActionController::Base
protect_from_forgery
@@ -157,8 +152,7 @@
protect_from_forgery store: CustomStore.new
end
-
-
+
@@ -191,22 +185,16 @@
-
-
- skip_forgery_protection(options = {})
-
-
+ skip_forgery_protection(options = {})
-
-
- Turn off request forgery protection. This is a wrapper for:
+
+Turn off request forgery protection. This is a wrapper for:
skip_before_action :verify_authenticity_token
See skip_before_action for allowed options.
-
-
+
diff --git a/src/classes/ActionController/RequestForgeryProtection/CookieStore.html b/src/classes/ActionController/RequestForgeryProtection/CookieStore.html
index 4b0c66f056..0378d9b528 100644
--- a/src/classes/ActionController/RequestForgeryProtection/CookieStore.html
+++ b/src/classes/ActionController/RequestForgeryProtection/CookieStore.html
@@ -75,17 +75,9 @@ Methods
Class Public methods
-
-
- new(cookie = :csrf_token)
-
-
+ new(cookie = :csrf_token)
-
-
-
-
@@ -114,17 +106,9 @@
Instance Public methods
-
-
- fetch(request)
-
-
+ fetch(request)
-
-
-
-
@@ -157,17 +141,9 @@
-
-
- reset(request)
-
-
+ reset(request)
-
-
-
-
@@ -192,17 +168,9 @@
-
-
- store(request, csrf_token)
-
-
+ store(request, csrf_token)
-
-
-
-
diff --git a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/Exception.html b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/Exception.html
index e69924c312..99c898fd65 100644
--- a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/Exception.html
+++ b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/Exception.html
@@ -81,17 +81,9 @@ Attributes
Class Public methods
-
-
- new(controller)
-
-
+ new(controller)
-
-
-
-
@@ -120,17 +112,9 @@
Instance Public methods
-
-
- handle_unverified_request()
-
-
+ handle_unverified_request()
-
-
-
-
diff --git a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession.html b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession.html
index e750eada13..dd724c2f6b 100644
--- a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession.html
+++ b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession.html
@@ -82,17 +82,9 @@ Methods
Class Public methods
-
-
- new(controller)
-
-
+ new(controller)
-
-
-
-
@@ -121,17 +113,11 @@
Instance Public methods
-
-
- handle_unverified_request()
-
-
+ handle_unverified_request()
-
-
- This is the method that defines the application behavior when a request is found to be unverified.
-
-
+
+This is the method that defines the application behavior when a request is found to be unverified.
+
diff --git a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession/NullCookieJar.html b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession/NullCookieJar.html
index 5ca9bc67fd..7000ef2289 100644
--- a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession/NullCookieJar.html
+++ b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession/NullCookieJar.html
@@ -64,17 +64,9 @@ Methods
Instance Public methods
-
-
- write(*)
-
-
+ write(*)
-
-
-
-
diff --git a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession/NullSessionHash.html b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession/NullSessionHash.html
index 3af8d7e1cf..9096a843e1 100644
--- a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession/NullSessionHash.html
+++ b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/NullSession/NullSessionHash.html
@@ -75,17 +75,9 @@ Methods
Class Public methods
-
-
- new(req)
-
-
+ new(req)
-
-
-
-
@@ -116,17 +108,11 @@
Instance Public methods
-
-
- destroy()
-
-
+ destroy()
-
-
- no-op
-
-
+
+no-op
+
@@ -149,17 +135,9 @@
-
-
- enabled?()
-
-
+ enabled?()
-
-
-
-
@@ -184,17 +162,9 @@
-
-
- exists?()
-
-
+ exists?()
-
-
-
-
diff --git a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/ResetSession.html b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/ResetSession.html
index 57f1c2d62c..2f8cfe3764 100644
--- a/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/ResetSession.html
+++ b/src/classes/ActionController/RequestForgeryProtection/ProtectionMethods/ResetSession.html
@@ -67,17 +67,9 @@ Methods
Class Public methods
-
-
- new(controller)
-
-
+ new(controller)
-
-
-
-
@@ -106,17 +98,9 @@
Instance Public methods
-
-
- handle_unverified_request()
-
-
+ handle_unverified_request()
-
-
-
-
diff --git a/src/classes/ActionController/RequestForgeryProtection/SessionStore.html b/src/classes/ActionController/RequestForgeryProtection/SessionStore.html
index 5d94db2741..6d0c60e86d 100644
--- a/src/classes/ActionController/RequestForgeryProtection/SessionStore.html
+++ b/src/classes/ActionController/RequestForgeryProtection/SessionStore.html
@@ -72,17 +72,9 @@ Methods
Instance Public methods
-
-
- fetch(request)
-
-
+ fetch(request)
-
-
-
-
@@ -107,17 +99,9 @@
-
-
- reset(request)
-
-
+ reset(request)
-
-
-
-
@@ -142,17 +126,9 @@
-
-
- store(request, csrf_token)
-
-
+ store(request, csrf_token)
-
-
-
-
diff --git a/src/classes/ActionController/Rescue.html b/src/classes/ActionController/Rescue.html
index 5a8031f9e0..9fc13a955e 100644
--- a/src/classes/ActionController/Rescue.html
+++ b/src/classes/ActionController/Rescue.html
@@ -93,17 +93,11 @@ Included Modules
Instance Public methods
-
-
- show_detailed_exceptions?()
-
-
+ show_detailed_exceptions?()
-
-
- Override this method if you want to customize when detailed exceptions must be shown. This method is only called when consider_all_requests_local is false. By default, it returns false, but someone may set it to request.local? so local requests in production still show the detailed exception pages.
-
-
+
+Override this method if you want to customize when detailed exceptions must be shown. This method is only called when consider_all_requests_local is false. By default, it returns false, but someone may set it to request.local? so local requests in production still show the detailed exception pages.
+
diff --git a/src/classes/ActionController/RespondToMismatchError.html b/src/classes/ActionController/RespondToMismatchError.html
index 6f7c4c0c27..72a5b92e49 100644
--- a/src/classes/ActionController/RespondToMismatchError.html
+++ b/src/classes/ActionController/RespondToMismatchError.html
@@ -91,17 +91,9 @@ Constants
Class Public methods
-
-
- new(message = nil)
-
-
+ new(message = nil)
-
-
-
-
diff --git a/src/classes/ActionController/StrongParameters.html b/src/classes/ActionController/StrongParameters.html
index e2dcbadea4..e31d3ec2fd 100644
--- a/src/classes/ActionController/StrongParameters.html
+++ b/src/classes/ActionController/StrongParameters.html
@@ -129,17 +129,11 @@ Methods
Instance Public methods
-
-
- params()
-
-
+ params()
-
-
- Returns a new ActionController::Parameters object that has been instantiated with the request.parameters.
-
-
+
+Returns a new ActionController::Parameters object that has been instantiated with the request.parameters.
+
@@ -172,17 +166,11 @@
-
-
- params=(value)
-
-
+ params=(value)
-
-
- Assigns the given value to the params hash. If value is a Hash, this will create an ActionController::Parameters object that has been instantiated with the given value hash.
-
-
+
+Assigns the given value to the params hash. If value is a Hash, this will create an ActionController::Parameters object that has been instantiated with the given value hash.
+
diff --git a/src/classes/ActionController/TestCase/Behavior.html b/src/classes/ActionController/TestCase/Behavior.html
index 706651aafb..0397e83b06 100644
--- a/src/classes/ActionController/TestCase/Behavior.html
+++ b/src/classes/ActionController/TestCase/Behavior.html
@@ -173,17 +173,9 @@ Attributes
Instance Public methods
-
-
- build_response(klass)
-
-
+ build_response(klass)
-
-
-
-
@@ -208,17 +200,9 @@
-
-
- controller_class_name()
-
-
+ controller_class_name()
-
-
-
-
@@ -243,17 +227,11 @@
-
-
- delete(action, **args)
-
-
+ delete(action, **args)
-
-
- Simulate a DELETE request with the given parameters and set/volley the response. See get for more details.
-
-
+
+Simulate a DELETE request with the given parameters and set/volley the response. See get for more details.
+
@@ -278,17 +256,9 @@
-
-
- generated_path(generated_extras)
-
-
+ generated_path(generated_extras)
-
-
-
-
@@ -313,15 +283,10 @@
-
-
- get(action, **args)
-
-
+ get(action, **args)
-
-
- Simulate a GET request with the given parameters.
+
+Simulate a GET request with the given parameters.
-
action: The controller action to call.
-
@@ -343,8 +308,7 @@
Note that the request method is not verified. The different methods are available to make the tests more expressive.
-
-
+
@@ -369,17 +333,11 @@
-
-
- head(action, **args)
-
-
+ head(action, **args)
-
-
- Simulate a HEAD request with the given parameters and set/volley the response. See get for more details.
-
-
+
+Simulate a HEAD request with the given parameters and set/volley the response. See get for more details.
+
@@ -404,17 +362,11 @@
-
-
- patch(action, **args)
-
-
+ patch(action, **args)
-
-
- Simulate a PATCH request with the given parameters and set/volley the response. See get for more details.
-
-
+
+Simulate a PATCH request with the given parameters and set/volley the response. See get for more details.
+
@@ -439,17 +391,11 @@
-
-
- post(action, **args)
-
-
+ post(action, **args)
-
-
- Simulate a POST request with the given parameters and set/volley the response. See get for more details.
-
-
+
+Simulate a POST request with the given parameters and set/volley the response. See get for more details.
+
@@ -474,15 +420,10 @@
-
-
- process(action, method: "GET", params: nil, session: nil, body: nil, flash: {}, format: nil, xhr: false, as: nil)
-
-
+ process(action, method: "GET", params: nil, session: nil, body: nil, flash: {}, format: nil, xhr: false, as: nil)
-
-
- Simulate an HTTP request to action by specifying request method, parameters and set/volley the response.
+
+Simulate an HTTP request to action by specifying request method, parameters and set/volley the response.
-
action: The controller action to call.
-
@@ -517,8 +458,7 @@
It’s not recommended to make more than one request in the same test. Instance variables that are set in one request will not persist to the next request, but it’s not guaranteed that all Rails internal state will be reset. Prefer ActionDispatch::IntegrationTest for making multiple requests in the same test.
Note that the request method is not verified.
-
-
+
@@ -579,17 +519,11 @@
-
-
- put(action, **args)
-
-
+ put(action, **args)
-
-
- Simulate a PUT request with the given parameters and set/volley the response. See get for more details.
-
-
+
+Simulate a PUT request with the given parameters and set/volley the response. See get for more details.
+
@@ -614,17 +548,9 @@
-
-
- query_parameter_names(generated_extras)
-
-
+ query_parameter_names(generated_extras)
-
-
-
-
@@ -649,17 +575,9 @@
-
-
- setup_controller_request_and_response()
-
-
+ setup_controller_request_and_response()
-
-
-
-
diff --git a/src/classes/ActionController/TestCase/Behavior/ClassMethods.html b/src/classes/ActionController/TestCase/Behavior/ClassMethods.html
index d3aeb92c5c..9a3ddb8254 100644
--- a/src/classes/ActionController/TestCase/Behavior/ClassMethods.html
+++ b/src/classes/ActionController/TestCase/Behavior/ClassMethods.html
@@ -70,17 +70,9 @@ Methods
Instance Public methods
-
-
- controller_class()
-
-
+ controller_class()
-
-
-
-
@@ -109,17 +101,9 @@
-
-
- controller_class=(new_class)
-
-
+ controller_class=(new_class)
-
-
-
-
@@ -144,17 +128,9 @@
-
-
- determine_default_controller_class(name)
-
-
+ determine_default_controller_class(name)
-
-
-
-
@@ -181,22 +157,16 @@
-
-
- tests(controller_class)
-
-
+ tests(controller_class)
-
-
- Sets the controller class name. Useful if the name can’t be inferred from test class. Normalizes controller_class before using.
+
+Sets the controller class name. Useful if the name can’t be inferred from test class. Normalizes controller_class before using.
tests WidgetController
tests :widget
tests 'widget'
-
-
+
diff --git a/src/classes/ActionController/UrlFor.html b/src/classes/ActionController/UrlFor.html
index a2eb3dba2b..e74c7bf818 100644
--- a/src/classes/ActionController/UrlFor.html
+++ b/src/classes/ActionController/UrlFor.html
@@ -98,17 +98,9 @@ Included Modules
Class Public methods
-
-
- new(...)
-
-
+ new(...)
-
-
-
-
@@ -138,17 +130,9 @@
Instance Public methods
-
-
- url_options()
-
-
+ url_options()
-
-
-
-
diff --git a/src/classes/ActionDispatch.html b/src/classes/ActionDispatch.html
index 4e1153729b..c9deadc1fe 100644
--- a/src/classes/ActionDispatch.html
+++ b/src/classes/ActionDispatch.html
@@ -403,20 +403,14 @@ Included Modules
Class Public methods
-
-
- unknown
-
-
+ unknown
-
-
- Specifies if the methods calling redirects in controllers and routes should
+
+Specifies if the methods calling redirects in controllers and routes should
be logged below their relevant log lines. Defaults to false.
-
-
+
@@ -444,17 +438,9 @@
Instance Public methods
-
-
- eager_load!()
-
-
+ eager_load!()
-
-
-
-
diff --git a/src/classes/ActionDispatch/AssertionResponse.html b/src/classes/ActionDispatch/AssertionResponse.html
index add0397b3a..c69d0a777d 100644
--- a/src/classes/ActionDispatch/AssertionResponse.html
+++ b/src/classes/ActionDispatch/AssertionResponse.html
@@ -95,17 +95,11 @@ Attributes
Class Public methods
-
-
- new(code_or_name)
-
-
+ new(code_or_name)
-
-
- Accepts a specific response status code as an Integer (404) or String (‘404’) or a response status range as a Symbol pseudo-code (:success, indicating any 200-299 status code).
-
-
+
+Accepts a specific response status code as an Integer (404) or String (‘404’) or a response status range as a Symbol pseudo-code (:success, indicating any 200-299 status code).
+
@@ -143,17 +137,9 @@
Instance Public methods
-
-
- code_and_name()
-
-
+ code_and_name()
-
-
-
-
diff --git a/src/classes/ActionDispatch/Assertions.html b/src/classes/ActionDispatch/Assertions.html
index c71c709efc..d7764a5a11 100644
--- a/src/classes/ActionDispatch/Assertions.html
+++ b/src/classes/ActionDispatch/Assertions.html
@@ -105,17 +105,9 @@ Included Modules
Instance Public methods
-
-
- html_document()
-
-
+ html_document()
-
-
-
-
diff --git a/src/classes/ActionDispatch/Assertions/ResponseAssertions.html b/src/classes/ActionDispatch/Assertions/ResponseAssertions.html
index d3431041dc..08d16d159e 100644
--- a/src/classes/ActionDispatch/Assertions/ResponseAssertions.html
+++ b/src/classes/ActionDispatch/Assertions/ResponseAssertions.html
@@ -76,20 +76,14 @@ Methods
Instance Public methods
-
-
- assert_in_body(text)
-
-
+ assert_in_body(text)
-
-
- Asserts that the given text is present somewhere in the response body.
+
+Asserts that the given text is present somewhere in the response body.
assert_in_body fixture(:name).description
-
-
+
@@ -114,20 +108,14 @@
-
-
- assert_not_in_body(text)
-
-
+ assert_not_in_body(text)
-
-
- Asserts that the given text is not present anywhere in the response body.
+
+Asserts that the given text is not present anywhere in the response body.
assert_not_in_body fixture(:name).description
-
-
+
@@ -152,15 +140,10 @@
-
-
- assert_redirected_to(url_options = {}, options = {}, message = nil)
-
-
+ assert_redirected_to(url_options = {}, options = {}, message = nil)
-
-
- Asserts that the response is a redirect to a URL matching the given options.
+
+Asserts that the response is a redirect to a URL matching the given options.
# Asserts that the redirection was to the "index" action on the WeblogController
assert_redirected_to controller: "weblog", action: "index"
@@ -178,8 +161,7 @@
# Permanently).
assert_redirected_to "/some/path", status: :moved_permanently
-
-
+
@@ -214,15 +196,10 @@
-
-
- assert_response(type, message = nil)
-
-
+ assert_response(type, message = nil)
-
-
- Asserts that the response is one of the following types:
+
+Asserts that the response is one of the following types:
-
:success - Status code was in the 200-299 range
-
@@ -241,8 +218,7 @@
# Asserts that the response code was status code 401 (unauthorized)
assert_response 401
-
-
+
diff --git a/src/classes/ActionDispatch/Assertions/RoutingAssertions.html b/src/classes/ActionDispatch/Assertions/RoutingAssertions.html
index cd11898aa6..6d16192a5c 100644
--- a/src/classes/ActionDispatch/Assertions/RoutingAssertions.html
+++ b/src/classes/ActionDispatch/Assertions/RoutingAssertions.html
@@ -95,15 +95,10 @@ Methods
Instance Public methods
-
-
- assert_generates(expected_path, options, defaults = {}, extras = {}, message = nil)
-
-
+ assert_generates(expected_path, options, defaults = {}, extras = {}, message = nil)
-
-
- Asserts that the provided options can be used to generate the provided path. This is the inverse of assert_recognizes. The extras parameter is used to tell the request the names and values of additional request parameters that would be in a query string. The message parameter allows you to specify a custom error message for assertion failures.
+
+Asserts that the provided options can be used to generate the provided path. This is the inverse of assert_recognizes. The extras parameter is used to tell the request the names and values of additional request parameters that would be in a query string. The message parameter allows you to specify a custom error message for assertion failures.
The defaults parameter is unused.
@@ -119,8 +114,7 @@
# Asserts that the generated route gives us our custom route
assert_generates "changesets/12", { controller: 'scm', action: 'show_diff', revision: "12" }
-
-
+
@@ -163,15 +157,10 @@
-
-
- assert_recognizes(expected_options, path, extras = {}, msg = nil)
-
-
+ assert_recognizes(expected_options, path, extras = {}, msg = nil)
-
-
- Asserts that the routing of the given path was handled correctly and that the parsed options (given in the expected_options hash) match path. Basically, it asserts that Rails recognizes the route given by expected_options.
+
+Asserts that the routing of the given path was handled correctly and that the parsed options (given in the expected_options hash) match path. Basically, it asserts that Rails recognizes the route given by expected_options.
Pass a hash in the second argument (path) to specify the request method. This is useful for routes requiring a specific HTTP method. The hash should contain a :path with the incoming request path and a :method containing the required HTTP verb.
@@ -199,8 +188,7 @@
# Test a custom route
assert_recognizes({controller: 'items', action: 'show', id: '1'}, 'view/item1')
-
-
+
@@ -242,15 +230,10 @@
-
-
- assert_routing(path, options, defaults = {}, extras = {}, message = nil)
-
-
+ assert_routing(path, options, defaults = {}, extras = {}, message = nil)
-
-
- Asserts that path and options match both ways; in other words, it verifies that path generates options and then that options generates path. This essentially combines assert_recognizes and assert_generates into one step.
+
+Asserts that path and options match both ways; in other words, it verifies that path generates options and then that options generates path. This essentially combines assert_recognizes and assert_generates into one step.
The extras hash allows you to specify options that would normally be provided as a query string to the action. The message parameter allows you to specify a custom error message to display upon failure.
@@ -269,8 +252,7 @@
# Tests a route with an HTTP method
assert_routing({ method: 'put', path: '/product/321' }, { controller: "product", action: "update", id: "321" })
-
-
+
@@ -303,17 +285,11 @@
-
-
- method_missing(selector, ...)
-
-
+ method_missing(selector, ...)
-
-
- ROUTES TODO: These assertions should really work in an integration context
-
-
+
+ROUTES TODO: These assertions should really work in an integration context
+
@@ -342,15 +318,10 @@
-
-
- with_routing(config = nil, &block)
-
-
+ with_routing(config = nil, &block)
-
-
- A helper to make it easier to test different route configurations. This method temporarily replaces @routes with a new RouteSet instance.
+
+A helper to make it easier to test different route configurations. This method temporarily replaces @routes with a new RouteSet instance.
The new instance is yielded to the passed block. Typically the block will create some routes using set.draw { match ... }:
@@ -361,8 +332,7 @@
assert_equal "/users", users_path
end
-
-
+
diff --git a/src/classes/ActionDispatch/Assertions/RoutingAssertions/ClassMethods.html b/src/classes/ActionDispatch/Assertions/RoutingAssertions/ClassMethods.html
index 5adfba8b3a..282dea51b3 100644
--- a/src/classes/ActionDispatch/Assertions/RoutingAssertions/ClassMethods.html
+++ b/src/classes/ActionDispatch/Assertions/RoutingAssertions/ClassMethods.html
@@ -58,15 +58,10 @@ Methods
Instance Public methods
-
-
- with_routing(&block)
-
-
+ with_routing(&block)
-
-
- A helper to make it easier to test different route configurations. This method temporarily replaces @routes with a new RouteSet instance before each test.
+
+A helper to make it easier to test different route configurations. This method temporarily replaces @routes with a new RouteSet instance before each test.
The new instance is yielded to the passed block. Typically the block will create some routes using set.draw { match ... }:
@@ -76,8 +71,7 @@
end
end
-
-
+
diff --git a/src/classes/ActionDispatch/Assertions/RoutingAssertions/WithIntegrationRouting/ClassMethods.html b/src/classes/ActionDispatch/Assertions/RoutingAssertions/WithIntegrationRouting/ClassMethods.html
index 00294f018d..cb534ffb45 100644
--- a/src/classes/ActionDispatch/Assertions/RoutingAssertions/WithIntegrationRouting/ClassMethods.html
+++ b/src/classes/ActionDispatch/Assertions/RoutingAssertions/WithIntegrationRouting/ClassMethods.html
@@ -58,17 +58,9 @@ Methods
Instance Public methods
-
-
- with_routing(&block)
-
-
+ with_routing(&block)
-
-
-
-
diff --git a/src/classes/ActionDispatch/AssumeSSL.html b/src/classes/ActionDispatch/AssumeSSL.html
index 04ac3c3b46..e6a33538bb 100644
--- a/src/classes/ActionDispatch/AssumeSSL.html
+++ b/src/classes/ActionDispatch/AssumeSSL.html
@@ -75,17 +75,9 @@ Methods
Class Public methods
-
-
- new(app)
-
-
+ new(app)
-
-
-
-
@@ -114,17 +106,9 @@
Instance Public methods
-
-
- call(env)
-
-
+ call(env)
-
-
-
-
diff --git a/src/classes/ActionDispatch/Callbacks.html b/src/classes/ActionDispatch/Callbacks.html
index 60b700ddc7..5e4ed82e6b 100644
--- a/src/classes/ActionDispatch/Callbacks.html
+++ b/src/classes/ActionDispatch/Callbacks.html
@@ -97,17 +97,9 @@ Included Modules
Class Public methods
-
-
- after(*args, &block)
-
-
+ after(*args, &block)
-
-
-
-
@@ -132,17 +124,9 @@
-
-
- before(*args, &block)
-
-
+ before(*args, &block)
-
-
-
-
@@ -167,17 +151,9 @@
-
-
- new(app)
-
-
+ new(app)
-
-
-
-
@@ -206,17 +182,9 @@
Instance Public methods
-
-
- call(env)
-
-
+ call(env)
-
-
-
-
diff --git a/src/classes/ActionDispatch/ContentSecurityPolicy.html b/src/classes/ActionDispatch/ContentSecurityPolicy.html
index 9bcf251b21..82eca9a108 100644
--- a/src/classes/ActionDispatch/ContentSecurityPolicy.html
+++ b/src/classes/ActionDispatch/ContentSecurityPolicy.html
@@ -169,17 +169,9 @@ Attributes
Class Public methods
-
-
- new()
-
-
+ new()
-
-
-
-
@@ -209,15 +201,10 @@
Instance Public methods
-
-
- block_all_mixed_content(enabled = true)
-
-
+ block_all_mixed_content(enabled = true)
-
-
- Specify whether to prevent the user agent from loading any assets over HTTP when the page uses HTTPS:
+
+Specify whether to prevent the user agent from loading any assets over HTTP when the page uses HTTPS:
policy.block_all_mixed_content
@@ -226,8 +213,7 @@
policy.block_all_mixed_content false
-
-
+
@@ -256,17 +242,9 @@
-
-
- build(context = nil, nonce = nil, nonce_directives = nil)
-
-
+ build(context = nil, nonce = nil, nonce_directives = nil)
-
-
-
-
@@ -292,17 +270,9 @@
-
-
- initialize_copy(other)
-
-
+ initialize_copy(other)
-
-
-
-
@@ -327,15 +297,10 @@
-
-
- plugin_types(*types)
-
-
+ plugin_types(*types)
-
-
- Restricts the set of plugins that can be embedded:
+
+Restricts the set of plugins that can be embedded:
policy.plugin_types "application/x-shockwave-flash"
@@ -344,8 +309,7 @@
policy.plugin_types
-
-
+
@@ -374,20 +338,14 @@
-
-
- report_uri(uri)
-
-
+ report_uri(uri)
-
-
- Enable the report-uri directive. Violation reports will be sent to the specified URI:
+
+Enable the report-uri directive. Violation reports will be sent to the specified URI:
policy.report_uri "/csp-violation-report-endpoint"
-
-
+
@@ -412,15 +370,10 @@
-
-
- require_sri_for(*types)
-
-
+ require_sri_for(*types)
-
-
- Specify asset types for which Subresource Integrity is required:
+
+Specify asset types for which Subresource Integrity is required:
policy.require_sri_for :script, :style
@@ -429,8 +382,7 @@
policy.require_sri_for
-
-
+
@@ -459,15 +411,10 @@
-
-
- sandbox(*values)
-
-
+ sandbox(*values)
-
-
- Specify whether a sandbox should be enabled for the requested resource:
+
+Specify whether a sandbox should be enabled for the requested resource:
policy.sandbox
@@ -481,8 +428,7 @@
policy.sandbox false
-
-
+
@@ -513,15 +459,10 @@
-
-
- upgrade_insecure_requests(enabled = true)
-
-
+ upgrade_insecure_requests(enabled = true)
-
-
- Specify whether user agents should treat any assets over HTTP as HTTPS:
+
+Specify whether user agents should treat any assets over HTTP as HTTPS:
policy.upgrade_insecure_requests
@@ -530,8 +471,7 @@
policy.upgrade_insecure_requests false
-
-
+
diff --git a/src/classes/ActionDispatch/ContentSecurityPolicy/Middleware.html b/src/classes/ActionDispatch/ContentSecurityPolicy/Middleware.html
index 1bd7c0c235..054c64c973 100644
--- a/src/classes/ActionDispatch/ContentSecurityPolicy/Middleware.html
+++ b/src/classes/ActionDispatch/ContentSecurityPolicy/Middleware.html
@@ -67,17 +67,9 @@ Methods
Class Public methods
-
-
- new(app)
-
-
+ new(app)
-
-
-
-
@@ -106,17 +98,9 @@
Instance Public methods
-
-
- call(env)
-
-
+ call(env)
-
-
-
-
diff --git a/src/classes/ActionDispatch/ContentSecurityPolicy/Request.html b/src/classes/ActionDispatch/ContentSecurityPolicy/Request.html
index d6c4e5e35e..09d34b0124 100644
--- a/src/classes/ActionDispatch/ContentSecurityPolicy/Request.html
+++ b/src/classes/ActionDispatch/ContentSecurityPolicy/Request.html
@@ -131,17 +131,9 @@ Constants
Instance Public methods
-
-
- content_security_policy()
-
-
+ content_security_policy()
-
-
-
-
@@ -166,17 +158,9 @@
-
-
- content_security_policy=(policy)
-
-
+ content_security_policy=(policy)
-
-
-
-
@@ -201,17 +185,9 @@
-
-
- content_security_policy_nonce()
-
-
+ content_security_policy_nonce()
-
-
-
-
@@ -242,17 +218,9 @@
-
-
- content_security_policy_nonce_directives()
-
-
+ content_security_policy_nonce_directives()
-
-
-
-
@@ -277,17 +245,9 @@
-
-
- content_security_policy_nonce_directives=(generator)
-
-
+ content_security_policy_nonce_directives=(generator)
-
-
-
-
@@ -312,17 +272,9 @@
-
-
- content_security_policy_nonce_generator()
-
-
+ content_security_policy_nonce_generator()
-
-
-
-
@@ -347,17 +299,9 @@
-
-
- content_security_policy_nonce_generator=(generator)
-
-
+ content_security_policy_nonce_generator=(generator)
-
-
-
-
@@ -382,17 +326,9 @@
-
-
- content_security_policy_report_only()
-
-
+ content_security_policy_report_only()
-
-
-
-
@@ -417,17 +353,9 @@
-
-
- content_security_policy_report_only=(value)
-
-
+ content_security_policy_report_only=(value)
-
-
-
-
diff --git a/src/classes/ActionDispatch/Cookies.html b/src/classes/ActionDispatch/Cookies.html
index d88399f741..1c1a536fbf 100644
--- a/src/classes/ActionDispatch/Cookies.html
+++ b/src/classes/ActionDispatch/Cookies.html
@@ -313,17 +313,9 @@ Constants
Class Public methods
-
-
- new(app)
-
-
+ new(app)
-
-
-
-
@@ -352,17 +344,9 @@
Instance Public methods
-
-
- call(env)
-
-
+ call(env)
-
-
-
-
diff --git a/src/classes/ActionDispatch/Cookies/ChainedCookieJars.html b/src/classes/ActionDispatch/Cookies/ChainedCookieJars.html
index 8bb7e230e4..2600c8365a 100644
--- a/src/classes/ActionDispatch/Cookies/ChainedCookieJars.html
+++ b/src/classes/ActionDispatch/Cookies/ChainedCookieJars.html
@@ -76,15 +76,10 @@ Methods
Instance Public methods
-
-
- encrypted()
-
-
+ encrypted()
-
-
- Returns a jar that’ll automatically encrypt cookie values before sending them to the client and will decrypt them for read. If the cookie was tampered with by the user (or a 3rd party), nil will be returned.
+
+Returns a jar that’ll automatically encrypt cookie values before sending them to the client and will decrypt them for read. If the cookie was tampered with by the user (or a 3rd party), nil will be returned.
If config.action_dispatch.encrypted_cookie_salt and config.action_dispatch.encrypted_signed_cookie_salt are both set, legacy cookies encrypted with HMAC AES-256-CBC will be transparently upgraded.
@@ -97,8 +92,7 @@
cookies.encrypted[:discount] # => 45
-
-
+
@@ -123,15 +117,10 @@
-
-
- permanent()
-
-
+ permanent()
-
-
- Returns a jar that’ll automatically set the assigned cookies to have an expiration date 20 years from now. Example:
+
+Returns a jar that’ll automatically set the assigned cookies to have an expiration date 20 years from now. Example:
cookies.permanent[:prefers_open_id] = true
# => Set-Cookie: prefers_open_id=true; path=/; expires=Sun, 16-Dec-2029 03:24:16 GMT
@@ -144,8 +133,7 @@
cookies.permanent.signed[:remember_me] = current_user.id
# => Set-Cookie: remember_me=BAhU--848956038e692d7046deab32b7131856ab20e14e; path=/; expires=Sun, 16-Dec-2029 03:24:16 GMT
-
-
+
@@ -170,15 +158,10 @@
-
-
- signed()
-
-
+ signed()
-
-
- Returns a jar that’ll automatically generate a signed representation of cookie value and verify it when reading from the cookie again. This is useful for creating cookies with values that the user is not supposed to change. If a signed cookie was tampered with by the user (or a 3rd party), nil will be returned.
+
+Returns a jar that’ll automatically generate a signed representation of cookie value and verify it when reading from the cookie again. This is useful for creating cookies with values that the user is not supposed to change. If a signed cookie was tampered with by the user (or a 3rd party), nil will be returned.
This jar requires that you set a suitable secret for the verification on your app’s secret_key_base.
@@ -189,8 +172,7 @@
cookies.signed[:discount] # => 45
-
-
+
@@ -215,17 +197,11 @@
-
-
- signed_or_encrypted()
-
-
+ signed_or_encrypted()
-
-
- Returns the signed or encrypted jar, preferring encrypted if secret_key_base is set. Used by ActionDispatch::Session::CookieStore to avoid the need to introduce new cookie stores.
-
-
+
+Returns the signed or encrypted jar, preferring encrypted if secret_key_base is set. Used by ActionDispatch::Session::CookieStore to avoid the need to introduce new cookie stores.
+
diff --git a/src/classes/ActionDispatch/DebugExceptions.html b/src/classes/ActionDispatch/DebugExceptions.html
index 6c68fafb70..2673b70496 100644
--- a/src/classes/ActionDispatch/DebugExceptions.html
+++ b/src/classes/ActionDispatch/DebugExceptions.html
@@ -79,17 +79,9 @@ Methods
Class Public methods
-
-
- new(app, routes_app = nil, response_format = :default, interceptors = self.class.interceptors)
-
-
+ new(app, routes_app = nil, response_format = :default, interceptors = self.class.interceptors)
-
-
-
-
@@ -117,17 +109,9 @@
-
-
- register_interceptor(object = nil, &block)
-
-
+ register_interceptor(object = nil, &block)
-
-
-
-
@@ -157,17 +141,9 @@
Instance Public methods
-
-
- call(env)
-
-
+ call(env)
-
-
-
-
diff --git a/src/classes/ActionDispatch/DebugLocks.html b/src/classes/ActionDispatch/DebugLocks.html
index 64a4117bf1..9affdf1bc0 100644
--- a/src/classes/ActionDispatch/DebugLocks.html
+++ b/src/classes/ActionDispatch/DebugLocks.html
@@ -88,17 +88,9 @@ Methods
Class Public methods
-
-
- new(app, path = "/rails/locks")
-
-
+ new(app, path = "/rails/locks")
-
-
-
-
@@ -128,17 +120,9 @@
Instance Public methods
-
-
- call(env)
-
-
+ call(env)
-
-
-
-
diff --git a/src/classes/ActionDispatch/ExceptionWrapper.html b/src/classes/ActionDispatch/ExceptionWrapper.html
index 1590a51718..c8725b7617 100644
--- a/src/classes/ActionDispatch/ExceptionWrapper.html
+++ b/src/classes/ActionDispatch/ExceptionWrapper.html
@@ -221,17 +221,9 @@ Attributes
Class Public methods
-
-
- new(backtrace_cleaner, exception)
-
-
+ new(backtrace_cleaner, exception)
-
-
-
-
@@ -263,17 +255,9 @@
-
-
- status_code_for_exception(class_name)
-
-
+ status_code_for_exception(class_name)
-
-
-
-
@@ -302,17 +286,9 @@
Instance Public methods
-
-
- actions()
-
-
+