我正在开发我的应用程序时,控制台突然出现了一个错误。
使用 Rails 控制台时,我无法创建或保存模型。这是我得到的错误:
rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418: syntax error, unexpected '=', expecting ')'
result = result = _callback_before_71
我恢复到以前在 git 中的提交,但它仍然无法正常工作......
完整的错误信息:
SyntaxError: /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418: syntax error, unexpected '=', expecting ')'
result = result = _callback_before_71
^
/Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:423: syntax error, unexpected keyword_end, expecting ')'
/Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:426: syntax error, unexpected keyword_end, expecting ')'
/Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:427: syntax error, unexpected $end, expecting ')'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:400:in `class_eval'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:400:in `__run_callback'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_validate_callbacks'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations.rb:228:in `run_validations!'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/callbacks.rb:53:in `block in run_validations!'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:403:in `_run__1438787982741389732__validation__2895348434256153547__callbacks'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_validation_callbacks'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/callbacks.rb:53:in `run_validations!'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations.rb:195:in `valid?'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/validations.rb:69:in `valid?'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/validations.rb:77:in `perform_validations'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/validations.rb:50:in `save'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/attribute_methods/dirty.rb:22:in `save'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/transactions.rb:208:in `transaction'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/transactions.rb:259:in `block in save'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/transactions.rb:258:in `save'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/persistence.rb:45:in `create'
from (irb):3
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /Users/justindomingue/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.3-p374