Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am wdawson4 on github.
  • I am wdawson (https://keybase.io/wdawson) on keybase.
  • I have a public key ASBx8bMMeMUnXeZFMMzxz3KIaoCIRhzB7YzuICJI3_I-Ago

To claim this, I am signing this object:

[{ "Name" : "Aesop's Tables", "position" : [-85.7302 , 37.5332 ] },
{ "Name" : "Award Winners Cafe", "position" : [-88.12595 , 41.3896 ] },
{ "Name" : "Acadia Cafe", "position" : [-68.04902 , 44.454 ] },
{ "Name" : "Adams Coffee Shop", "position" : [-71.01119 , 42.25639 ] },
{ "Name" : "Admiralty Island National Monument", "position" : [-134.16105 , 57.61806 ] },
{ "Name" : "African American Civil War Memorial", "position" : [-77.02569 , 38.91639 ] },
{ "Name" : "African Burial Ground National Monument", "position" : [-73.99364 , 40.71367 ] },
{ "Name" : "Agate Fossil Beds National Monument", "position" : [-103.75492 , 42.42428 ] },
{ "Name" : "Agua Fria National Monument", "position" : [-112.07633 , 34.15417 ] },
{ "Name" : "SF Cafe Shop", "position" : [-122.46122 , 37.77 ] },
Pundit makes the following assumptions about this class:
The class has the same name as some kind of model class, only suffixed with the word "Policy".
The first argument is a user. In your controller, Pundit will call the current_user method to retrieve what to send into this argument
The second argument is some kind of model object, whose authorization you want to check. This does not need to be an ActiveRecord or even an ActiveModel object, it can be anything really.
The class implements some kind of query method, in this case update?. Usually, this will map to the name of a particular controller action.
That's it really.