class

ActionController::Parameters

Inherits Reference < Object

Constructors

from(raw : Hash) : self
Source
new(parameters : Hash(String, Value) = {} of String => Value, permitted : Bool = false)
Source

Instance methods

[](key : String | Symbol) : Value | Nil
Source
[]=(key : String | Symbol, value : Value) : Value
Source
[]?(key : String | Symbol) : Value | Nil
Source
dig(key : String | Symbol, *rest : String | Symbol) : Value | Nil
Source
empty?
Source
expect(*filters) : Parameters | Value

permit + require: every filtered key must be present and non-empty. expect({"post" => [:title, :body]}) — same Hash-argument style as permit.

Source
fetch(key : String | Symbol, default = nil)
Source
has_key?(key : String | Symbol) : Bool
Source
key?(key : String | Symbol) : Bool
Source
keys
Source
parameters
permit(*filters) : Parameters

permit(:title, {"author" => [:name]}) — nested/array filters are passed as a Hash argument instead of Ruby keyword syntax (documented deviation: Crystal can't take heterogeneous keyword splats here).

Source
permit!
Source
permitted=(permitted : Bool)
Source
permitted?
Source
require(key : String | Symbol | Array(String | Symbol)) : Parameters

require(:post) returns the nested parameters themselves (as in Rails); require([:a, :b]) returns a Parameters holding those keys.

Source
size
Source
slice(*keys : String | Symbol) : Parameters
Source
to_h
Source
to_s(io : IO) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source
to_unsafe_h
Source

Nested types