You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# policy
class ContactPolicy
attr_reader :user, :contact
def initialize(user, contact)
@user = user
@contact = contact
end
def number?
true
end
# controller
class ContactsController < ApplicationController
before_filter :load_object, :only => [:show, :edit, :update, :destroy]
def number
num = {number: Contacts.count}
authorize num # would look for the HashPolicy not in ContactPolicy
render json: num
end
should i just do ?
authorize Contact
The text was updated successfully, but these errors were encountered:
classContactsController < ApplicationControllerbefore_filter:load_object,:only=>[:show,:edit,:update,:destroy]defnumbernum={number: Contact.count}authorizeContact,:count?# give this a tryrenderjson: numendend
should i just do ?
authorize Contact
The text was updated successfully, but these errors were encountered: