I'm upgrading a Rails application I've inherited from 3.2 to 4.0.1. I followed and finished the edge guide here:
http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0
I've gotten everything fixed except for a single error that I can't seem to find the root cause of. When I attempt to save a User model object, I'm met with the following error:
[1] pry(main)> User.create(name: "test user", email: "[email protected]", password: "testPassword123", password_confirmation: "testPassword123")
(0.6ms) BEGIN
(0.9ms) ROLLBACK
NoMethodError: undefined method `to_datetime' for false:FalseClass
from /home/cmhobbs/src/serve2perform/.gem/ruby/2.3.0/gems/activesupport-4.0.1/lib/active_support/core_ext/date_time/calculations.rb:161:in `<=>'
activesupport
4.0.1 and rals
4.0.1 are installed. I use chgems and I purged my .gem/
directory and Gemfile.lock
before bundling again.
Here is a Gist of the User model.
And here is all of the backtrace output I could get from pry
.
Here is a link to the User table schema.
created_at
andupdated_at
– Airmailfalse
. But it is a mystery to me what callback it is. Probably it's not one of those inuser
model but more likely a callback from a gem, perhaps devise, or something else? – Foretopgallantactive_support/callbacks.rb
file inActiveSupport
on this line (see your stack trace for the precise file location) and add a debug line before it:Rails.logger.debug "#{name} #{str}"
. This should reveal the callbacks internal name and the callbacks code. Then please paste here the debug that is printed for the callback with the same name as in your stack trace:_run__768037688__create__callbacks
. – Foretopgallantschema.rb
, but that's just a wild guess. Try to remove (comment out) pieces of code until you get smaller example to achieve the error - there's a big chance that you will find bugging piece of code pretty fast. Also, unrelated, but avoidTime.now
and useTime.current
(shortcut forTime.zone.now
), or you might get into trouble :) – Clupeidpsql -c "\d+ users" {database}
. You can see what the makeup of the table is. But, again, doubtful (but post here if that is somehow the case!). Most likely, perhaps, is that one of your gems is doing something odd. One step may be to strip out extraneous gems, get the create command working, then re-introduce them one by one until you break again. If you post your Gemfile here, maybe someone can guide/shortcut that process. – Fabozzi