0

This answer is 5 years old and wasn't all that specific.

I just lost a couple of hours in development. My code worked after a server restart. I can't be sure, but I think it is because of a change I made to a scoped validation in a model:

validates :name, presence: true , uniqueness: {scope: :institution_id}

This year old answer doesn't seem to apply to my situation. In particular, this rule does not seem to have held for me:

"The general rule of thumb here is making changes to anything outside of app/ or config/routes.rb will require a restart."

Is there some other rule to consider? While developing, I'd like to avoid restarting the server as much as possible.

I suppose one valid answer could be this answer is still correct. If it gets upvoted enough, I'll assume that it remains accurate and that my adventure with debugging-that-was-fixed-with-a-server-restart was some other-yet-to-be-defined issue.

ADDENDUM:
I am using:

  • Mac OS 10.9.5
  • Rails 4.1.5
  • Spring 1.1.3

Server startup:

[2014-10-12 09:29:29] INFO  WEBrick 1.3.1  
[2014-10-12 09:29:29] INFO  ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]  
[2014-10-12 09:29:29] INFO  WEBrick::HTTPServer#start: pid=9366 port=3000  
Community
  • 1
  • 1
Perry Horwich
  • 2,798
  • 3
  • 23
  • 51

1 Answers1

0

I assume you are using OSX? You should try using POW so your server restarts automatically when it needs to.

If you are using Rails 4.1+ you could also consider setting up Spring. This way there will be no need to manually start/stop background processes or restarting your rails server after you made changes that require a restart.

Severin
  • 8,508
  • 14
  • 68
  • 117
  • Thanks Severin, I have updated the question. I didn't know anything about POW. Just read a portion of the manual. Seems to promise a lot. I haven't caome across many online accounts of folks developing in rails with POW. Some questions that come to mind: 1) How easy would it be to remove POW if I was unsatisfied? 2) Would POW somehow intelligently restart 'rails s' or would it simply start it when requested? 3) If pow has some rules for starting the rails server, what are they? #3 sounds like the answer to the OP. – Perry Horwich Oct 12 '14 at 12:39