Home > Blockchain >  rails server not serving git files of current branch
rails server not serving git files of current branch

Time:01-20

I setup a rails project and started working in a specific branch (branch1). I was doing ok with rails s until I wanted to setup another branch (branch2) with different files. I did git fetch origin branch2 for getting the second branch, and was doing fine configuring this branch (bundle, rake db:setup, etc...) up until running rails s. When I start my server, it should serve the files of my current checkout branch (branch2) but it serves the files of the previous branch I was working on (branch1).

Things I tried:

  • Thought git fetch won't actually get the remote branch to my workspace for the server to load up the correct files. So I deleted the fetched branch and did git checkout -b branch2 origin/branch2. Server still loads files in branch1.
  • Did spring stop so the server don't load up files stored in the cache (I was told this... I don't really know how spring works). Still, server loads files in branch1
  • I cloned the repository again, and set up everything for branch2. But still rails s manages to load branch1 (I would say that branch1 is the default when you clone the repo)

What I expect:

  • Doing rails s in checkout branch1 should load and display app in branch1.
  • Doing rails s in checkout branch2 should load and display app in branch2.

Any help would be really really REALLY appreciated, I've been stuck with this for hours now... thanks in advance.

P.S. The branches share the same database, I don't if that would help but I thought it was worth mentioning

CodePudding user response:

Thanks for the help on the comments, unfortunately those answers didn't work for me.

Turns out, the server was loading the app correctly in localhost but because the navigation menu on the project is too big, it was saved in the cache to optimize the load in every branch. So I needed to run a script for changing the navigation menu (the script was provided to me by my colleagues that were in the project long before me).

So if you have this problem, ask your colleagues, contributors, boss if there is something you are missing.

  • Related