varvet / pundit

Minimal authorization through OO design and pure Ruby classes
MIT License
8.28k stars 630 forks source link

Update README.md #653

Closed natronic closed 2 years ago

natronic commented 4 years ago

Make it clear that authorize controller code has to be placed at the top of controller method(s). Otherwise page will throw errors from any instance variables, etc. that get evaluated before authorization occurs.

Linuus commented 4 years ago

Can you give some more context here? There’s no requirement to call this method at any specific point from Pundits point of view.

yagudaev commented 4 years ago

Can you give some more context here? There’s no requirement to call this method at any specific point from Pundits point of view.

His point that is confusing to a rails new comer where to place the code. His suggestion shows it is to be called from a controller action. It is not a macro method and wouldn't make sense outside of the request/response cycle.

Burgestrand commented 2 years ago

Thanks! We've written the documentation in a similar way for the other code examples, so this makes it consistent if nothing else 🎉

yagudaev commented 2 years ago

Great job thanks Burgestrand, OSS is hard thanks for the hard work ❤️