[英]Configuring Rails to generate the correct first line in development.rb
I am using Rails 4.1.1 and Ruby 2.0.0. 我正在使用Rails 4.1.1和Ruby 2.0.0。 When I run
rails new test_app
, the generated file test_app/config/environments/development.rb
always contains the first line: 当我运行
rails new test_app
,生成的文件test_app/config/environments/development.rb
始终包含第一行:
Rails.application.configure do
The above line causes an undefined local variable error. 上一行导致未定义的局部变量错误。 It should be:
它应该是:
TestApp::Application.configure do
Is there a way to configure rails so that it always generates the correct name? 有没有一种方法可以配置rails,以使其始终生成正确的名称?
Using Ruby 2.0.0 and Rails 4.1.1, I just created a new Rails app using the command rails new test_app_rails_4-1-1
. 使用Ruby 2.0.0和Rails 4.1.1,我只是使用
rails new test_app_rails_4-1-1
命令创建了一个新的Rails应用程序。 The top line of the development.rb file is Rails.application.configure do
, which is the correct syntax. development.rb文件的第一行是
Rails.application.configure do
,这是正确的语法。
I just looked at a the development.rb file in a Rails 4.0.1 app. 我只是在Rails 4.0.1应用程序中查看了development.rb文件 。 The first line in that file is
HeyLookARailsApp::Application.configure do
. 该文件的第一行是
HeyLookARailsApp::Application.configure do
。 So it seems like the syntax in Rails 4.1.1 is different that Rails 4.0.1. 因此,看起来Rails 4.1.1中的语法与Rails 4.0.1不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.