Added colours for teams
This commit is contained in:
6
app/serializers/reservation_serializer.rb
Normal file
6
app/serializers/reservation_serializer.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class ReservationSerializer < ActiveModel::Serializer
|
||||
attributes :id, :start_time, :end_time
|
||||
|
||||
belongs_to :customer
|
||||
belongs_to :team, serializer: TeamSerializer
|
||||
end
|
||||
9
app/serializers/team_serializer.rb
Normal file
9
app/serializers/team_serializer.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class TeamSerializer < ActiveModel::Serializer
|
||||
include ColorHelper
|
||||
|
||||
attributes :id, :name, :color
|
||||
|
||||
def color
|
||||
team_color(object.id)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user