开发者

Undefined local variable or method name 'projectname' for main:object

开发者 https://www.devze.com 2023-03-17 16:57 出处:网络
Ok so I\'m having some issues with starting the rails server as well as running any rake commands as it fails out with an undefined local variable or method name \'Newventureclub\'(which is the name o

Ok so I'm having some issues with starting the rails server as well as running any rake commands as it fails out with an undefined local variable or method name 'Newventureclub' (which is the name of my project). This error started happening after running a couple migration and adding some paths to my routes file, but even stepping backward I can't seem to get it to work again. Running --trace I get this:

/Users/mbs89/webdev/nvc/newventureclub/config/routes.rb:1
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:127:in `reload_routes!'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:127:in `each'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:127:in `reload_routes!'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:120:in `routes_reloader'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `call'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application/finisher.rb:51
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application/finisher.rb:52:in `call'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application/finisher.rb:52
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `run_initializers'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
/Users/mbs89/webdev/nvc/newventureclub/config/environment.rb:5
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:103:in `require'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:103:in `require_environment!'
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:216:in `initialize_tasks'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2/bin/rake:32
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

When I try to start the server I get a slightly different error message:

undefined local variable or method `Newventureclub' for main:Object (NameError)
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:127:in `reload_routes!'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:127:in `each'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:127:in `reload_routes!'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:120:in `routes_reloader'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `call'
    from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application/finisher.rb:51
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application/finisher.rb:52:in `call'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application/finisher.rb:52
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `run_initializers'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:134:in `init开发者_StackOverflowialize!'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
    from /Users/mbs89/webdev/nvc/newventureclub/config/environment.rb:5
    from /Users/mbs89/webdev/nvc/newventureclub/config.ru:3:in `require'
    from /Users/mbs89/webdev/nvc/newventureclub/config.ru:3
    from /Library/Ruby/Gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
    from /Library/Ruby/Gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
    from /Users/mbs89/webdev/nvc/newventureclub/config.ru:1:in `new'
    from /Users/mbs89/webdev/nvc/newventureclub/config.ru:1

Here is my routes file which I think is causing the error but I can't spot it:

Newventureclub::Application.routes.draw do

  resources :list_locations

  resources :list_controls

  resources :companies  
  get "all_members" => "main#members", :as => "all_members"

  get "org_chart" => "main#orgchart", :as => "org_chart"
  get "all_investments" => "main#investments", :as => "all_investments"
  get "all_memories" => "main#memories", :as => "all_memories"
  get "all_retreats" => "main#retreats", :as => "all_retreats"
  get "calendar" => "main#calendar", :as => "calendar"
  get "log_out" => "sessions#destroy", :as => "log_out"
  get "log_in" => "sessions#new", :as => "log_in"
  get "sign_up" => "members#new", :as => "sign_up"

  resources :members

  resources :sessions

  root :to => "sessions#new"

EDIT here is my environment.rb file:

 # Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
Newventureclub::Application.initialize!

EDIT2: Here is my application.rb took out all the comments

require File.expand_path('../boot', __FILE__)

require 'rails/all'


Bundler.require(:default, Rails.env) if defined?(Bundler)

module Newventureclub
  class Application < Rails::Application

    config.encoding = "utf-8"

    config.filter_parameters += [:password]
  end
end
0

精彩评论

暂无评论...
验证码 换一张
取 消