我无法让我的rails服务器现在开始搜索几个小时。任何人都可以帮忙吗?我已经添加了以下代码
/Users/Iain/rails_projects/ali_bodill_photogrphy/config/environments/development.rb:1:in `<top (required)>': undefined local variable or method `ali_bodill_photogrphy' for main:Object (NameError)
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `require'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `block in require'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in `load_dependency'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in `require'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/engine.rb:590:in `each'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/engine.rb:590:in `block in <class:Engine>'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/initializable.rb:30:in `run'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/initializable.rb:44:in `each'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/initializable.rb:44:in `tsort_each_child'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /Users/Iain/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/railties-4.0.8/lib/rails/application.rb:215:in `initialize!'
from /Users/Iain/rails_projects/ali_bodill_photogrphy/config/environment.rb:5:in `<top (required)>'
from /Users/Iain/rails_projects/ali_bodill_photogrphy/config.ru:3:in `require'
from /Users/Iain/rails_projects/ali_bodill_photogrphy/config.ru:3:in `block in <main>'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Users/Iain/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/Iain/rails_projects/ali_bodill_photogrphy/config.ru:in `new'
from /Users/Iain/rails_projects/ali_bodill_photogrphy/config.ru:in `<main>'
我真的很陌生。
ali_bodill_photogrphy.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
#在运行时提供资产时添加其他错误检查。 #检查未正确声明的链轮依赖项。 #引发有用的错误消息。 config.assets.raise_runtime_errors = true
#引发缺失翻译的错误 #config.action_view.raise_on_missing_translations = true 端
答案 0 :(得分:3)
由于您是新手,请告诉您有关调试过程的信息
-
错误强>
此处显示错误(第一行):
未定义的局部变量或方法`ali_bodill_photogrphy'for main:Object(NameError)
与“计算机”相关问题的基本底线是必须存在错误的逻辑原因。开始寻找问题原因的合理位置是识别问题是什么;因此寻找错误信息
在您的情况下,消息显示您ali_bodill_photography
的{{1}}上没有方法line 1
:
config/environments/development.rb
-
<强>修正强>
这是Rails的核心问题。如果您更改了此文件,则需要将其更改回来;或者查看其他文件来衡量“正确”方法需要做什么。
我将从Rails 4应用程序中提供一些示例:
ali_bodill_photogrphy.application.configure do
基于上述文件,我建议您查看您的Rails版本,并修改#config/environments/development.rb (4.1.4)
Rails.application.configure do
#config/environments/development.rb (4.0.0)
Appname::Application.configure do
#config/environments/development.rb (3.2)
AppName::Application.configure do
文件的顶部以复制上述任一示例
因此,如果您有Rails 4.1.4(最新版本),则可以将development.rb
替换为all_bodill_photograph
。如果你有一个较小版本的Rails,看起来你需要使用应用程序名称的复制版本 - Rails