app/controllers/api/v1/teams_controller.rb
# Returns a JSON-encoded Array of all the rows.
# Each array element is a JSON-encoded hash of a single row.
# The keys of the Hash are the attributes as string.
#
# This action is not restricted by authorization because is capped to
# return 20 rows max.
#
# === Additional params:
# - 'q': a matching (sub)string for the Team.name
#
Returns a JSON-encoded Array of all the rows.
Each array element is a JSON-encoded hash of a single row.
The keys of the Hash are the attributes as string.

This action is not restricted by authorization because is capped to
return 20 rows max.

Additional params:
'q': a matching (sub)string for the Team.name
Returns a JSON - encoded Array of all the rows . Each array element is a JSON - encoded hash of a single row . The keys of the Hash are the attributes as string . This action is not restricted by authorization because is capped to return 20 rows max . Additional params : ' q ' : a matching ( sub ) string for the Team . name
def index
    if params['q']
      filter = "%#{params['q']}%"
      @teams = Team.where( ["name LIKE ?", filter] )
          .order(:name).limit(20)
    else
      @teams = Team.order(:name).limit(20)
    end
    render status: 200, json: @teams
  end
def index if params [ 'q' ] filter = "%#{params['q']}%" @teams = Team . where ( [ "name LIKE ?" , filter ] ) . order ( :name ) . limit ( 20 ) else @teams = Team . order ( :name ) . limit ( 20 ) end render status : 200 , json : @teams end
Returns a JSON-encoded Array of all the rows.
Returns a JSON - encoded Array of all the rows .
# DEBUG #    puts "\r\n**** Api::V1::SwimmersController #index ****" #    puts "- PARAMS: " << params.inspect # (This uses Squeel DSL syntax for where clauses)