简体   繁体   中英

Rails state_machine not working on staging environment

gem list state*

*** LOCAL GEMS ***
state_machine (1.1.2)

In the console on my development environment:

>> require 'state_machine'
=> []

In my staging environment:

>> require 'state_machine'
=> false

Both environments have the same state_machine (1.1.2).

Does anyone know why?

First, if require returns false, it means only that the file has already been successfully loaded.

Are you using bundler to manage gems? Assuming a Rails 3 app, this is the default, and you should most definitely use it. If you have a separate environment (using the Rails meaning of "environment") for staging, then be sure your Gemfile.rb lists the state_machine gem for all environments. Finally, in order for changes to the Gemfile.rb to take effect, you must run bundle install before it will be available within Rails.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM