dobtco / procure-io

*NOT CURRENTLY MAINTAINED* Procurement software for the 21st century.
Other
40 stars 16 forks source link

Logging in as admin 1st time on Heroku clean deploy, NoMethodError for User#valid_password? #134

Closed daguar closed 11 years ago

daguar commented 11 years ago

Error Description

This is an odd error I encountered, and I've resolved it, but wanted to document it. It's probably low-priority until such time as new deploys start occurring.

First, I followed the Heroku deploy instructions current as of today (Permalink: https://github.com/dobtco/procure-io/blob/66aaf97af814935c18d1b41faac9505e7a17c279/README.md ).

Having created an initial admin user with the rake task, I tried to log in to the Heroku deploy as that user. Examining the logs, I had a 503 error with a NoMethodError for valid_password? (on the instance object of User).

I was able to fix this by setting validate_password_field to true in the acts_as_authentic call in User:

...
 22 class User < ActiveRecord::Base
 23   acts_as_authentic do |c|
 24     c.require_password_confirmation = false
 25     c.validate_password_field = false # current code base has this false; I set to true
 26     c.disable_perishable_token_maintenance = true
 27   end
...

So then I was able to log in successfully as the admin user.

Here are the two weird things:

A. I reverted validate_password_field back to false, and the Heroku deploy is still working (e.g., I can log in as admin without the 503).

B. This problem did not occur on my local development machine -- only on Heroku.

Plan to Test/Fix

  1. Replicate the error on another clean Heroku deploy
  2. Attempt to replicate the error with a patched code base on a clean Heroku deploy (e.g., setting validate_password_field to true)
ajb commented 11 years ago

seems like heroku needs a heroku restart after migrating the database.