ruby - How to tell when Rails app is activated by migration? -


i'm trying create migration app, , in app i'm using gem tries startup different service upon app startup. apparently, creating migration...

rails generate migration addsomestufftotable stuff:string 

...activates app, , gem tries connect startup service. appears starting app via generating migration makes service startup unable connect, keeps sleeping , trying again, never running migration.

in gem, i've dealt rake, i've got far:

myservice.start unless defined? rake or defined? irb 

this handles rake problem (like rake db:migrate, rake db:populate), how can handle creation of migration, (as far know) not rake task?

you try using environment variables disabling service:

myservice.start unless env['no_service'] 

and run command this:

no_service=1 rails generate migration addsomestufftotable stuff:string 

however, doubt scales well, if multiple developers in app. better approach might reverse of this, start service if particular env variable is present. however, going direction, you'd need make sure app servers set variable, example:

apache: setenv start_service 1

nginx: env start_service=1

thin: start_service=1 thin start


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -