Use render_serialized for rendering instances in UserBadgeController.

This commit is contained in:
Vikhyat Korrapati 2014-03-19 14:46:16 +05:30
parent 2dc5e3c81e
commit 50ce93a850
1 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@ class UserBadgesController < ApplicationController
def index
params.require(:username)
user = fetch_user_from_params
render json: user.user_badges
render_serialized(user.user_badges, UserBadgeSerializer, root: "user_badges")
end
def create
@ -17,7 +17,7 @@ class UserBadgesController < ApplicationController
badge = fetch_badge_from_params
user_badge = BadgeGranter.grant(badge, user, granted_by: current_user)
render json: user_badge
render_serialized(user_badge, UserBadgeSerializer, root: "user_badge")
end
def destroy