2011-07-18 12 views
9

gmaps4railsを有効にしたモデルを含むレーキタスクを実行すると、このエラーが発生します。 acts_as_gmappable正しく完了しました。rakeタスクの(オブジェクト)のための未定義のメソッド `gmaps '

enter code here 
troy$ rake populate:scans --trace 
** Invoke populate:scans (first_time) 
** Invoke environment (first_time) 
** Execute environment 
** Execute populate:scans 
http://goo.gl/fb/977ze 
Sat, 16 Jul 2011 19:43:59 GMT 
47.676506 
-122.121872 
91df0f32209c5212XXXXXXXXXXXXXXX 
rake aborted! 

undefined method `gmaps' for #<Scan:0x000001051fb9a8> 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/attribute_methods.rb:392:in `method_missing' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/attribute_methods.rb:46:in `method_missing' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/gmaps4rails-0.9.1/lib/gmaps4rails/acts_as_gmappable.rb:12:in `process_geocoding' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:415:in `_run_validate_callbacks' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/validations.rb:212:in `run_validations!' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/validations/callbacks.rb:67:in `block in run_validations!' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:414:in `_run_validation_callbacks' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/validations/callbacks.rb:67:in `run_validations!' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/validations.rb:179:in `valid?' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/validations.rb:55:in `valid?' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/validations.rb:75:in `perform_validations' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/validations.rb:43:in `save' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/attribute_methods/dirty.rb:21:in `save' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:240:in `block (2 levels) in save' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:207:in `transaction' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:290:in `with_transaction_returning_status' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:240:in `block in save' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:251:in `rollback_active_record_state!' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:239:in `save' 
/Users/troy/Documents/projects/qrbrowser/lib/tasks/populate.rake:42:in `block (3 levels) in <top (required)>' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:239:in `block in each' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:238:in `upto' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:238:in `each' 
/Users/troy/Documents/projects/qrbrowser/lib/tasks/populate.rake:23:in `block (2 levels) in <top (required)>' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `call' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `each' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain' 
/Users/troy/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `each' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in `run' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load' 
/Users/troy/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>' 
Tasks: TOP => populate:scans 
+1

は、あなたが 'gmaps' を持っていますか列またはメソッドを使用していますか? – apneadiving

+0

申し訳ありません - このサイトから電子メール通知が届かない場合 - プロジェクトに招待してコードを表示しました。チェックする時間がある場合はここに更新を掲載します –

+1

これはなぜ必要なのですか? Ruby 1.9やRails 3との互換性はありませんか?修正を知ってよかったですが、修正を必要とした根本原因を理解したいと思います。 – dlehman

答えて

14

解決方法1:

acts_as_gmappable :process_geocoding => false 

解決方法2:

あなたがモデルのインスタンスを作成している、実行します。

@scan.instance_eval do 
    def process_geocoding 
    true 
    end 
end 
+3

あなたは素晴らしいです!私が今まで見たことのない最高の宝石のサポート - あなたのようなメンバーとのコミュニティーにいることは素晴らしいことです。 –

+0

ありがとうトロイ、私は唯一のものではないと信じています;) – apneadiving

関連する問題