instance method to_ary

Ruby on Rails 4.2.9

Since v3.1.12 Last seen in v4.2.9

Available in: v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9

Signature

to_ary()

Be super clear that a response object is not an Array. Defining this would make implicit splatting work, but it also makes adding responses as arrays work, and “flattening” responses, cascading to the rack body! Not sensible behavior.

Source
# File actionpack/lib/action_dispatch/http/response.rb, line 292
    def to_ary
      ActiveSupport::Deprecation.warn(<<-MSG.squish)
        `ActionDispatch::Response#to_ary` no longer performs implicit conversion
        to an array. Please use `response.to_a` instead, or a splat like `status,
        headers, body = *response`.
      MSG

      to_a
    end

Defined in actionpack/lib/action_dispatch/http/response.rb line 292 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Response

Type at least 2 characters to search.

↑↓ navigate · open · esc close