Rails 4 doesn't detect application

后端 未结 3 772
逝去的感伤
逝去的感伤 2021-02-13 04:15

After updating to Rails 4, I\'m trying to start the server, but it won\'t start. Simply put, the application doesn\'t seem to get \"detected\", like there is no application in t

相关标签:
3条回答
  • 2021-02-13 05:10

    Mostly, I've been had by my own laziness. (Even though laziness is the mother of efficiency ;o) ) I've made a point of not using Bundle when running Rails server.

    Rails 4.0.0.beta changes the way it boots up. But, since I was using my "old" version of Rails, an older 4.0.0-beta I had lying around in my local gems, which didn't have the change, I didn't notice when the change was made to my bundle.

    Now, when came the time to deploy, the obligatory bundle-exec couldn't boot because my code was used to boot the old way.

    The solution

    Do like the message says to: bundle exec rails new .. And use Bundle this time! At that point, Rails will generate the boilerplate stuff, namely the missing boot files like ./bin/rails.

    It will also update some config files, and try to overwrite some stuff. In my case, everything is checked into source control, so there's a bit of diff'ing and choosing whether to overwrite or not and reverting after.

    An maybe better idea (I haven't bothered to) would be to branch out in Git, run the "upgrade" rails-new, overwrite everything, commit that, and then three-way merge back with the main branch.

    0 讨论(0)
  • 2021-02-13 05:12

    Rails 4 did change the way it boots up.

    Fortunately, you don't have to run rails-new, since there is a handy task for that.

    Rails 4 Release Notes:

    6.1  Notable changes

    • Your app's executables now live in the bin/ dir. Run rake rails:update:bin to get bin/bundle, bin/rails, and bin/rake.
    0 讨论(0)
  • 2021-02-13 05:16

    If your bin folder is already in place, you may just need to run bundle install first. This solved the problem for me after cloning a repo that was working perfectly on another machine.

    0 讨论(0)
提交回复
热议问题