Configuration files are used in rails projects to determine how rails versions switch versions.

  question, ruby

I’ve been messing with this open source project recently.canvas-lms

After configuring the environment according to the steps in his wiki, he ran up and found it was rails2.3.18

Then I looked at his Gemfile carefully and found a configuration file of canvas_rails3.

# You can enable the not-yet-complete Rails3 support by either defining a
 # CANVAS_RAILS3 env var, or create an empty RAILS3 file in the canvas config dir
 if ENV['CANVAS_RAILS3']
 CANVAS_RAILS3 = ENV['CANVAS_RAILS3'] !  = '0'
 else
 CANVAS_RAILS3 = File.exist?  (File.expand_path("../RAILS3", __FILE__))
 end
 CANVAS_RAILS2 = !  CANVAS_RAILS3

Discovery uses ENV[‘CANVAS_RAILS3’] to control whether rails version is 2 or 3. Would you like to ask how the environment variable value of ENV[‘CANVAS_RAILS3’] should be modified or assigned? Was it passed in from the command line? I didn’t quite understand rubydoc’s discovery.

Rails3.2 is quite different from current rails4, which may cause the website to fail after upgrading rails. Therefore, it is recommended to specify the same version as the project in gemfile and then bundle install.