Git Product home page Git Product logo

Comments (13)

DanielKehoe avatar DanielKehoe commented on June 30, 2024 2

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.

DanielKehoe avatar DanielKehoe commented on June 30, 2024

Are you using Rails 4.1.0.rc2? Does the migration work if you use SQLite?

from rails-devise-pundit.

DanielKehoe avatar DanielKehoe commented on June 30, 2024

Closing issue due to lack of response.

from rails-devise-pundit.

binyamindavid avatar binyamindavid commented on June 30, 2024

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.

jackson-sandland avatar jackson-sandland commented on June 30, 2024

The vagueness...location?

from rails-devise-pundit.

DanielKehoe avatar DanielKehoe commented on June 30, 2024

Do you have an issue to report?

from rails-devise-pundit.

binyamindavid avatar binyamindavid commented on June 30, 2024

@jackson-sandland not sure i understand your comment.

from rails-devise-pundit.

jackson-sandland avatar jackson-sandland commented on June 30, 2024

@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:inasync_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:inyield'
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.

jackson-sandland avatar jackson-sandland commented on June 30, 2024

@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.

DanielKehoe avatar DanielKehoe commented on June 30, 2024

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.

jackson-sandland avatar jackson-sandland commented on June 30, 2024

@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:

<%= f.label :username %>

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.

DanielKehoe avatar DanielKehoe commented on June 30, 2024

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.

jackson-sandland avatar jackson-sandland commented on June 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.