coopdevs/timeoverflow

View on GitHub
app/controllers/device_tokens_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class DeviceTokensController < ApplicationController
  before_action :authenticate_user!

  def create
    @device_token = DeviceToken.new device_token_params.merge! user_id: current_user.id

    if @device_token.save
      head :created
    else
      head :unprocessable_entity
    end
  end

  private

  def device_token_params
    params.permit(:token)
  end
end