2016-04-28 23 views
2

私は私のレールサーバを起動しようとしていますが、私は以下のエラートレースを取得しています。Railsでどのように宝石をデバッグできますか?

は、私がここで言及ラインコメントアウトしました:

4.2.0/lib/audited/auditor.rb:48:in `audited' 
    from /home/david-vm/Documents/rails_projects/bane/app/models/user.rb:9:in `<class:User>' 

を、そして私はそれを実行するために得ることができますが、私はそれを破っている理由はわかりません。だから私はおそらくbyebugを使用して問題を追跡することを考えていましたが、どうすればそのことを知ることができないのでしょうか。または、この問題のトラブルシューティングを行う別の方法がありますか?ありがとう!

エラー

/home/david-vm/.rvm/gems/ruby-2.3.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `connect': Server name not found in configuration files (TinyTds::Error) 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `initialize' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:280:in `new' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:280:in `dblib_connect' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:271:in `connect' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:59:in `initialize' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/sqlserver_base.rb:18:in `new' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/sqlserver_base.rb:18:in `sqlserver_connection' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:436:in `new_connection' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:446:in `checkout_new_connection' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:565:in `retrieve_connection' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:113:in `retrieve_connection' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:87:in `connection' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/model_schema.rb:230:in `table_exists?' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/primary_key.rb:97:in `get_primary_key' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/primary_key.rb:85:in `reset_primary_key' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/primary_key.rb:73:in `primary_key' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/audited-activerecord-4.2.0/lib/audited/adapters/active_record.rb:7:in `default_ignored_attributes' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/audited-4.2.0/lib/audited/auditor.rb:48:in `audited' 
from /home/david-vm/Documents/rails_projects/bane/app/models/user.rb:9:in `<class:User>' 
from /home/david-vm/Documents/rails_projects/bane/app/models/user.rb:1:in `<top (required)>' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:457:in `load' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:457:in `block in load_file' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:647:in `new_constants_in' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:456:in `load_file' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:354:in `require_or_load' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:494:in `load_missing_constant' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:261:in `const_get' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:261:in `block in constantize' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `each' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `inject' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `constantize' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:566:in `get' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:597:in `constantize' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise.rb:377:in `get' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:81:in `to' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:76:in `modules' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:93:in `routes' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:160:in `default_used_route' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:70:in `initialize' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise.rb:411:in `new' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise.rb:411:in `add_mapping' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/rails/routes.rb:241:in `block in devise_for' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/rails/routes.rb:240:in `each' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/rails/routes.rb:240:in `devise_for' 
from /home/david-vm/Documents/rails_projects/bane/config/routes.rb:11:in `block in <top (required)>' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:423:in `instance_exec' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:423:in `eval_block' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:401:in `draw' 
from /home/david-vm/Documents/rails_projects/bane/config/routes.rb:1:in `<top (required)>' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `each' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `load_paths' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:16:in `reload!' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:26:in `block in updater' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/file_update_checker.rb:75:in `execute' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:27:in `updater' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each' 
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!' 
from /home/david-vm/Documents/rails_projects/bane/config/environment.rb:5:in `<top (required)>' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require_environment!' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:142:in `require_application_and_environment!' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:67:in `console' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!' 
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>' 
from bin/rails:4:in `require' 
from bin/rails:4:in `<main>' 

User.rb

class User < ActiveRecord::Base 
     # Include default devise modules. Others available are: 
     # :confirmable, :lockable, :timeoutable and :omniauthable 
     devise :ldap_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable 
     after_destroy :ensure_an_admin_remains 
     before_create { generate_token(:auth_token) } 

     # Audit changes made except for the columns as specified below 
     audited except: [:last_seen_at, :sign_in_count, :last_sign_in_at, :last_sign_in_ip, :password_digest] 
     has_associated_audits 

     acts_as_tagger 
     acts_as_taggable_on :roles 

    # associations, methods, etc... 

    end 

更新

は私のdatabase.ymlのは「HADNそうにもかかわらず、それはDNSの問題でしたが判明t changed - サーバー名が機能しなくなりました。誰かがこのような問題を抱えている場合に備えてアップデートを追加しました。これをチェックする価値があります。

+0

編集するファイルを '4.2.0/lib/audited/auditor.rb'で開き、例外の場所の前に' binding.pry'を挿入してください。 –

答えて

3

答えはスタックトレースです。あなたのシステム上のどのファイルがエラーを起こしているかを正確に伝えています。そのファイルが宝石から来た、またはあなたのコンピュータの別の部分に住んでいるという事実は無関係です。

/home/david-vm/.rvm/gems/ruby-2.3.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `connect': Server name not found in configuration files (TinyTds::Error)

開き、ファイルエディタで(バックトレースでまたは任意のファイルが最も適切と思われる)こと、それが吹いています行の前にそこにbinding.pry(あなたが使用しているものは何でもまたはbyebug、またはデバッガを、)スティック(74)を上げる。次に、アプリを再起動し、アプリ内のファイルであるかのようにデバッグします。

+0

ありがとうございます。 – daveomcd

関連する問題