我在OpenShift上设置了一个Rails应用程序并提取了默认代码。当我尝试运行它时,我收到以下错误:
C:/Development/Ruby/lib/ruby/gems/2.3.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load': C:/HEATH3N/FirstApp/config/initializers/session_store.rb:1: syntax error, unexpected .. (SyntaxError)
../../.openshift/lib/session_store.rb
我不清楚问题是什么。我查看了有问题的文件,没有看到任何错误。我在Stack Overflow上发现了其他问题,询问该文件的另一个问题(旧的Ruby版本不支持新的哈希样式)但是我使用Ruby 2.3(Rails 4.1.4)并且我的错误是不同的
require File.join(Rails.root,'lib','openshift_secret_generator.rb')
# Be sure to restart your server when you modify this file.
# Set token based on intialize_secret function (defined in initializers/secret_generator.rb)
Rails.application.config.session_store :cookie_store, :key => initialize_secret(
:session_store,
'_railsapp_session'
)
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# RailsApp::Application.config.session_store :active_record_store
答案 0 :(得分:0)
尝试这样的事情 -
require File.expand_path(‘../lib/openshift_secret_generator.rb‘, __FILE__)
或
require Rails.root.join('lib', 'openshift_secret_generator.rb').to_s
如果其中一个或两个都适合你,请更新。