annotation ActionController::Param::Converter

Overview

defines a custom parser for strong parameters

# for converting comma seperated lists
# i.e. `"id-1,id-2,id-3"`
struct ConvertStringArray
  def convert(raw : String)
    raw.split(',').map!(&.strip).reject(&.empty?).uniq!
  end
end

@[AC::Route::GET("/", converters: {tags: ConvertStringArray})]
def find_tagged(tags : Array(String))
  # ...
end

Defined in:

action-controller/router/builder.cr