0

I created an app on one Mac. It runs fine. I checked it into GitHub and pushed it to the remote. I then go to another mac and do git fetch origin, followed by git reset --hard. I follow this with bundle install, then rails db:reset, and rails db:migrate. I then try to register exactly as I did on the other mac. I get:

ActionController::InvalidAuthenticityToken in Devise::RegistrationsController#create

I'm afraid I'm having a problem with moving the code between machines. They both have exactly the same version of rvm, rails, rbenv, etc. It doesn't seem like it should be this flaky. What other steps are necessary?

John Wooten
  • 685
  • 1
  • 6
  • 21
  • probably something to do with `initializers/session_store.rb` – Josh Brody May 09 '19 at 22:42
  • 1
    I don't think its a problem with code transfer, I think you forgot to do devise install or something. did you try https://stackoverflow.com/questions/20875591/actioncontrollerinvalidauthenticitytoken-in-registrationscontrollercreate – Vishal May 10 '19 at 05:18
  • Thank you for this link. I had left out an important step. I thought more of the environment like the state of the database, etc. would be captured by the git commit. Apparently after checking out the app, I must go through many of the setup steps to get it actually working. – John Wooten May 10 '19 at 19:25

1 Answers1

0

I realized after ready the above answer from Vishal, that my environment was not persisted in github. I realize now that I have to check out the code, then run bundle install, then rake db:create, then rake db:migrate, then finally rails s, if I got not errors in the previous. When I did this, I found I had a different rails version on the target computer than I did on the source computer.

I now use a script 'laptop' which I located at: https://github.com/monfresh/laptop.git

This works on a mac ( I use macs pretty exclusively ) and sets up the same environment on each one where it is run. After doing this, I find I can check in codes on one mac, then check them out on another, run laptop, then my rails apps work correctly.

John Wooten
  • 685
  • 1
  • 6
  • 21