Skip to content

Instantly share code, notes, and snippets.

@x1wins
x1wins / application_controller.rb
Last active Dec 12, 2019
model user_id onwer check
View application_controller.rb
class ApplicationController < ActionController::Base
def is_owner user_id
unless user_id == current_user.id
render json: nil, status: :forbidden
return
end
end
def is_owner_object data
if data.nil? or data.user_id.nil?
return render status: :not_found