Pundit provides a set of helpers that guide Ruby programmer in leveraging regular Ruby classes and object oriented design patterns to build a simple, robust and scaleable authorization system.
Questions tagged [pundit]
439 questions
0
votes
1 answer
Cannot get Heroku to correctly deploy Rails app using devise, rolify, and pundit
I have a mostly blank Rails app that I added devise, rolify, and pundit to along with some very basic usage in my views/controllers. It works great on my development environment (Cloud 9).
However, when I deploy to Heroku, the build says everything…

Captain Stack
- 3,572
- 5
- 31
- 56
0
votes
1 answer
Rails 4 Pundit - policies in parent models
I'm trying to use rails 4 with pundit policies.
I have a profile model and a projects model. Projects are HABTM with profiles.
I have a project policy, that has a create? action (set to true).
In my profile show page, I want to allow users to create…

Mel
- 2,481
- 26
- 113
- 273
0
votes
1 answer
How to allow file multiple with pundit permitted_attributes
I have an Issue model and polymorphic attachments association. Pundit is used to handle authorization and strong parameters. When I use simple file input for attachment, like this:
<%= f.simple_fields_for :attachments do |attachments| %>
<%=…

Oleg Boris
- 3
- 1
0
votes
1 answer
unable to find scope NilClassPolicy::Scope for NilClass
I am building application that currently has a simple authorization requirments:
All users can view the data of all controllers.
Only Admin can create/edit the data.
The project use admin gem so no controllers in my application (although I can…

user664859
- 153
- 2
- 13
0
votes
2 answers
Pundit: user_signed_in helper
I am using Pundit to deal with authorizations.
I want my user's profiles to be visible by everyone so in my user_policy.rb, I have:
def show?
true # Anyone can view a show
end
In my users/show.html.erb, the "edit profile" button is…

Graham Slick
- 6,692
- 9
- 51
- 87
0
votes
1 answer
Pundit authorization when 2 user models + admin role
I'm new to Rails and exercising. I have two user models, Student and Prof. I added an admin role to the Student model with enum.
I want to allow a Prof's profile to be edited by the owner of the profile or an admin.
Here is my code in…

Yimanei
- 242
- 2
- 8
0
votes
1 answer
Admin user approving SQL changes from a user
I've read into Cancan and Pundit (also Devise) for managing users in a Rails App. But I wanted to know if something was possible.
Basically, I want to have users change/add lines in a table (using SQLite at the moment, but will be moving to SQL in…

jimps
- 65
- 12
0
votes
1 answer
Pundit raising AuthorizationNotPerformedError on a loop where authorize object is called
I have two rails app :
one is a "front-end app" responsible for displaying data, taking input from the user and sending data to the API (the second app). The second is an API dealing with database operations and sending JSON to the front end app.
I…

David Geismar
- 3,152
- 6
- 41
- 80
0
votes
0 answers
Trouble deploying pundit authorization in Rails 4.2.4 with devise
I am a junior developer working on my first web application for a customer, an electronic commerce portal using Rails 4.2.4, Devise and a pins scaffolding.
Devise is working great and anyone can signup and login and CRUD a pin.
Problem: Users cannot…

Chris Dormani
- 476
- 8
- 21
0
votes
1 answer
Pundit throws undefined method `user'
I cannot restrict the Project model view to a owning user. Cannot figure this one out:
Error:
undefined method `user' for #
project_policy.rb
class ProjectPolicy < ApplicationPolicy
def show?
…

The Whiz of Oz
- 6,763
- 9
- 48
- 85
0
votes
0 answers
Rails 4 & Pundit - expressing policy permissions
I am trying to make an app in Rails 4.
I am trying to use pundit gem for authorisations.
I have an organisation model, a preference model and a user model.
The associations are:
User.rb
has_one :organisation
Organisation.rb
belongs_to :user
has_one…

Mel
- 2,481
- 26
- 113
- 273
0
votes
3 answers
Can you disable Pundit with Devise and Active Admin?
I have an existing Rails app that has Devise / Pundit running on the User model.
I have followed:
How to get Active Admin to work with Pundit after login
https://gist.github.com/tomchentw/8579571
I don't need authorization right now - Devise for…

Dan Tappin
- 2,692
- 3
- 37
- 77
0
votes
0 answers
Rails 4 - Pundit Policies
Im trying to make an app in Rails 4.
I am using Pundit (or trying to).
I have an application policy and an article policy.
Something isn't working. If I set my article policy for show? to be false, I expect not to be able to see the show page for…

Mel
- 2,481
- 26
- 113
- 273
0
votes
1 answer
Reading the pundit gem documentation where is .admin defined?
I have a moderator relationships table which assigns users as mods to groups by pairing their user id with the group id in the table.
I want only mods to be able to create a group.
I am trying to use the pundit gem to do this but i'm stuck on the…

Rob
- 1,835
- 2
- 25
- 53
0
votes
1 answer
Rails 4 with Devise & Pundit - @user or @current_user
I am trying to make an app with Rails 4 and devise and pundit (with rolify for roles)
In the:
class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
According to this Go…

Mel
- 2,481
- 26
- 113
- 273