Logan Serman
Logan Serman

Reputation: 29870

After switching branches, Rails throws undefined method inside of a helper module

Not sure if I could reliably reproduce this, but sometimes when I switch branches in development all requests start throwing an undefined method error inside of a helper. The method is present on both branches. I am using global helpers (helper :all).

To fix the issue, I go into the helper file and save any change. Usually I just add a new line to the end of it. After saving, it works fine. Seems like a caching issue.

Has anyone else seen this and resolved it? I am on Rails 4.2.1. As far as I know this only happens in development mode.

Upvotes: 0

Views: 73

Answers (1)

infused
infused

Reputation: 24337

Since you are using Rails 4.2, spring has probably cached the code from the old branch. After switching to the new branch remember to run:

spring stop

Spring will restart itself the next time you run the server, tests, or other Rails commands.

Upvotes: 1

Related Questions