简体   繁体   English

配置Rails以在development.rb中生成正确的第一行

[英]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.

相关问题 rails生成rspec:install config / environments / development.rb:1:在`<top(required)>':undefined method`configure' - rails generate rspec:install config/environments/development.rb:1:in `<top (required)>': undefined method `configure' 将变量添加到config / development.rb rails引擎 - Adding Variables to config/development.rb rails engine 没有development.rb的情况下如何运行Rails应用程序 - how is it possible to run a rails app without development.rb 具有2个域的Rails应用程序:在initializers / devise.rb和environment / development.rb中定义2个SMTP? - Rails app with 2 domains: Define 2 SMTP's in initializers/devise.rb & environments/development.rb? 允许用户更改一部分development.rb - Allow a user to change part of the development.rb 找不到config / environments / development.rb命令 - config/environments/development.rb command not found 在development.rb中隐藏纯文本密码 - Hide Plain Text Password in development.rb 迁移 Rails 6.0.34 -&gt; 6.1 后,我无法在 config/environments/development.rb 中使用 model - After migration Rails 6.0.34 -> 6.1 I can't use model inside the config/environments/development.rb Rails 5:从development.rb删除quiet_assets_path时出错 - Rails 5: Error when removed quiet_assets_path from development.rb Rails 3在config / environments / development.rb中从lib加载类的问题 - Rails 3 problem loading classes from lib in config/environments/development.rb
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM