"Works on my machine" -- Rails app works 100% on dev Machines, 90% in Production

Hello everyone! I’ve spent some time researching here, and you all seem like a great group! I’m here to learn more about RoR, and hope to help where I can. My quandary: I’ve recently submitted a post to Stack Overflow about a very strange problem. In short: I have an app that works perfectly in development, but one function totally fails in production. The details are here: https://stackoverflow.com/…/add-new-user-works-in…] I do appreciate any insight any of you can offer, because I am completely stumped!

Thank you in advance, and I look forward to helping out here as well!

I commented on the StackOverflow question, but it’s most likely related to this query:

SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]]

It might be running as some sort of authentication, and maybe it should not be for create. If you should be authenticated as a user to create a user, perhaps the User with id = 2 doesn’t exist in your production database.

You aren’t running User.new(user_params) because the email existence check isn’t happening, so the failure is not likely related to User.new or @user.save.

I think you’re right. The email check wasn’t happening because I was running my user controller before the Devise controller, which would verify the email check, for example. After switching in my routes.rb the order of loading Devise before my custom user controller, then it worked. Thank you so much for your insight!