Comments (2)
I've moved the functionality to the file config/initializers/pundit.rb. It extends the ApplicationController. Some developers like to add the code to the Application controller file. Instead, to segregate our Pundit-specific code, we use an initializer file. There's a detailed explanation in my Pundit Tutorial but let me know if you need more information.
Can you say more about the error you got?
from rails-devise-pundit.
I see that you've moved that into an initializer now!
I was getting an error stating authorize is an undefined method on show in the users_controller. However, that was after some editing of of the app that I completed.
I've reverted to my first commit, which was a fresh app composer setup of rails-devise-pundit. On that, I'm getting a lot of errors from Rspec which I've pasted below. When I click through the app, after sign up there's a redirect loop error from the browser. When I type directly into the URL bar after signing up, it will only allow me to access root - /users/{sign_out, 1, 2, etc} all redirect to root.
I'll need to fix this over the next few hours for my own app, but I suspect there's an issue with the composer gem for pundit at the moment...but I might be wrong.
Finished in 1.15 seconds (files took 3.32 seconds to load)
30 examples, 9 failures, 1 pending
Failed examples:
rspec ./spec/features/users/sign_in_spec.rb:11 # Sign in user cannot sign in if not registered
rspec ./spec/features/users/sign_in_spec.rb:21 # Sign in user can sign in with valid credentials
rspec ./spec/features/users/sign_in_spec.rb:32 # Sign in user cannot sign in with wrong email
rspec ./spec/features/users/sign_in_spec.rb:43 # Sign in user cannot sign in with wrong password
rspec ./spec/features/users/sign_out_spec.rb:11 # Sign out user signs out successfully
rspec ./spec/features/users/user_edit_spec.rb:18 # User edit user changes email address
rspec ./spec/features/users/user_show_spec.rb:30 # User profile page user cannot see another user's profile
rspec ./spec/features/visitors/navigation_spec.rb:11 # Navigation links view navigation links
rspec ./spec/features/visitors/sign_up_spec.rb:11 # Sign Up visitor can sign up with valid email address and password
Finished in 1.15 seconds (files took 3.32 seconds to load)
30 examples, 9 failures, 1 pending
from rails-devise-pundit.
Related Issues (20)
- Tests fail when Devise Confirmable module is used HOT 7
- How to make this app render json?thank u HOT 1
- Generator for haml/simple form views are not consistent with the design HOT 1
- RAILS_ENV=production rake assets:precompile - Failed to precompile HOT 6
- [DUPLICATE] Error from undefined method `authorize' HOT 1
- Net::SMTPAuthenticationError at /users HOT 2
- names aren't being saved HOT 1
- Error thrown at the end of the install script HOT 1
- git commands always run, even though I choose "no" in the wizzard HOT 1
- Add dotenv-rails to gemfile for omni-auth setup
- /pundit.rb:9:in `block in <module:PunditHelper>': uninitialized constant PunditHelper::Pundit (NameError)
- How to handle if user have multiple roles? HOT 1
- Why do you use attr_reader when you also use @ in action methods?
- Rails 4 error: NoMethodError - undefined method `for' for Devise::ParameterSanitizer HOT 7
- Sass::SyntaxError at /File to import not found or unreadable: bourbon. HOT 1
- MySQL access error
- undefined method authorize HOT 1
- app generator cannot find gem 'factory_girl' HOT 1
- rspec tests fail out of the box HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails-devise-pundit.