Comments (13)
I've just deployed the app to Heroku and did not encounter any problem. Try:
$ heroku pg:reset DATABASE
$ heroku run rake db:migrate
$ heroku run rake db:seed
$ heroku restart
Maybe you forgot to run $ heroku run rake db:migrate
?
Also check your Gemfile to make sure you've specified:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.1.4'
from rails-devise-pundit.
Are you using Rails 4.1.0.rc2? Does the migration work if you use SQLite?
from rails-devise-pundit.
Closing issue due to lack of response.
from rails-devise-pundit.
I tried this too and it didn't work. So i thought it would be better to create roles like this.
# have zero as the default role. Since enum auto does it for me
t.integer :role, default: 0, null: false
#then my user model looks like this
enum role: [:user, :banned, :admin]
Not sure if it's bad but it seems to work.
from rails-devise-pundit.
The vagueness...location?
from rails-devise-pundit.
Do you have an issue to report?
from rails-devise-pundit.
@jackson-sandland not sure i understand your comment.
from rails-devise-pundit.
@DanielKehoe I'm having this exact same issue...I'm using Devise and Rails 4 - the sign up works beautifully locally, but not on heroku. These are the logs =>
2014-07-08T22:45:47.074079+00:00 app[web.1]: Processing by Devise::RegistrationsController#new as HTML
2014-07-08T22:45:47.087034+00:00 app[web.1]: F, [2014-07-08T22:45:47.086932 #5] FATAL -- :
2014-07-08T22:45:47.087038+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "admin" does not exist
2014-07-08T22:45:47.087039+00:00 app[web.1]: LINE 5: WHERE a.attrelid = '"admin"'::regclass
2014-07-08T22:45:47.087043+00:00 app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2014-07-08T22:45:47.087041+00:00 app[web.1]: ^
2014-07-08T22:45:47.087045+00:00 app[web.1]: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2014-07-08T22:45:47.087046+00:00 app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
2014-07-08T22:45:47.087065+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:430:in log' 2014-07-08T22:45:47.087048+00:00 app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum 2014-07-08T22:45:47.087056+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:774:in
async_exec'
2014-07-08T22:45:47.087049+00:00 app[web.1]: WHERE a.attrelid = '"admin"'::regclass
2014-07-08T22:45:47.087063+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.3/lib/active_support/notifications/instrumenter.rb:20:in instrument' 2014-07-08T22:45:47.087082+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.3/lib/active_record/connection_adapters/schema_cache.rb:56:in
yield'
2014-07-08T22:45:47.087051+00:00 app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
2014-07-08T22:45:47.087058+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.3/lib/ac
from rails-devise-pundit.
@DanielKehoe I have reset the database on Heroku. I have checked the schema. Admin is a table that exists, and the routes are defined in routes.rb.
from rails-devise-pundit.
Also you say that "Admin is a table that exists." But the application has no table named 'admin'. The table is 'users'.
from rails-devise-pundit.
@DanielKehoe Thank you! I ran the migration and then checked the results...I must have deleted a migration so when I rake:db migrated the app on heroku the Admin table was not being created. I made a new migration, and I have solved that issue! However, now I am getting a 500 error in the Heroku logs because I added a :username attribute to the Devise form, but it is producing the following:
2014-07-08T23:55:19.663959+00:00 app[web.1]: Rendered devise/registrations/new.html.erb within layouts/application (2.0ms)
2014-07-08T23:55:19.667137+00:00 app[web.1]: ActionView::Template::Error (undefined method `username' for #):
2014-07-08T23:55:19.667139+00:00 app[web.1]: 4: <%= devise_error_messages! %>
2014-07-08T23:55:19.667142+00:00 app[web.1]: 6:
2014-07-08T23:55:19.667144+00:00 app[web.1]: 7: <%= f.text_field :username, autofocus: true %>
2014-07-08T23:55:19.664099+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2014-07-08T23:55:19.667133+00:00 app[web.1]: F, [2014-07-08T23:55:19.667038 #8] FATAL -- :
2014-07-08T23:55:19.667141+00:00 app[web.1]: 5:
from rails-devise-pundit.
I can help you when you encounter errors with the example application. I can't help with errors introduced by your custom code.
My Rails and Devise Tutorial has a chapter on adding additional attributes to the Devise views. It might be helpful. You can also ask on Stack Overflow.
from rails-devise-pundit.
Thank you Daniel. It's working!
On Tue, Jul 8, 2014 at 5:03 PM, Daniel Kehoe [email protected]
wrote:
I can help you when you encounter errors with the example application. I
can't help with errors introduced by your custom code.My Rails and Devise Tutorial http://railsapps.github.io/rails-devise/
has a chapter on adding additional attributes to the Devise views. It might
be helpful. You can also ask on Stack Overflow.—
Reply to this email directly or view it on GitHub
#5 (comment)
.
from rails-devise-pundit.
Related Issues (20)
- Tests fail when Devise Confirmable module is used HOT 7
- include Pundit not included in Application Controller HOT 2
- 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.