ensl.org/app/controllers/api/v1/teams_controller.rb

24 lines
551 B
Ruby
Raw Permalink Normal View History

2016-04-16 23:05:18 +00:00
class Api::V1::TeamsController < Api::V1::BaseController
def index
render json: Api::V1::UsersCollection.as_json
end
def show
@team = Team.find params[:id]
render json: {
id: @team.id,
name: @team.name,
logo: @team.logo,
members: @team.teamers.active.map do |m|
{
id: m.user.id,
username: m.user.username,
steamid: m.user.steamid
}
end
}
rescue ActiveRecord::RecordNotFound
raise ActionController::RoutingError.new("User Not Found")
end
end