! def index stats = StatService.search(current_user, params[:ids], params[:query]) respond_with stats, root: :stats end ! def show service = StatService.find(current_user, params[:id]) respond_with service.subject end ! def create service = StatService.new(Stat.new) service.save(permitted_params, current_user) ! respond_with service.subject end ! def update service = StatService.find(current_user, params[:id]) service.save(permitted_params, current_user) ! respond_with service.subject end ! def destroy service = StatService.find(current_user, params[:id]) service.destroy(current_user) ! respond_with service.subject end ! private def permitted_params params.require(:stat).permit(*StatService.permitted_params) end end end end