简体   繁体   English

Redmine+Bundler - method_missing “has_key?”

[英]Redmine+Bundler - method_missing “has_key?”

here is the problem details:这是问题的详细信息:

undefined method `has_key?' for nil:NilClass
/usr/local/redmine-1.2.0/lib/redmine/menu_manager.rb:77:in `add'
/usr/local/redmine-1.2.0/lib/redmine/menu_manager.rb:371:in `push'
/usr/local/redmine-1.2.0/lib/redmine.rb:153
/usr/local/redmine-1.2.0/lib/redmine/menu_manager.rb:301:in `map'
/usr/local/redmine-1.2.0/lib/redmine.rb:152
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.0/config/initializers/30-redmine.rb:5
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:173:in `load_without_new_constant_marking'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:173:in `load'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:622:in `load_application_initializers'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:621:in `each'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:621:in `load_application_initializers'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:176:in `process'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
/usr/local/redmine-1.2.0/config/environment.rb:20
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.0/vendor/rails/railties/lib/tasks/misc.rake:4
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/bin/rake:32
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/bin/rake:19:in `load'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/bin/rake:19
Tasks: TOP => db:migrate => environment

Gemfile:宝石文件:

source "http://rubygems.org"
gem "rails", "2.3.11"
gem "rack", "1.1.1"
gem "i18n", "0.4.2"
gem "rubytree"
gem "coderay",  "~> 0.9.7"

rubygem version: 1.3.6红宝石版本:1.3.6

by the way i tried menu_manager.rb patch file but it returned an error: http://www.redmine.org/attachments/5368/menu_manager.patch顺便说一句,我尝试了 menu_manager.rb 补丁文件,但它返回了一个错误: http://www.redmine.org/attachments/5368/menu_manager.patch

/usr/local/redmine-1.2.0/lib/redmine/menu_manager.rb:1: syntax error, unexpected tIDENTIFIER, expecting kDO or '{' or '('
diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb
            ^
/usr/local/redmine-1.2.0/lib/redmine/menu_manager.rb:1: syntax error, unexpected tIDENTIFIER, expecting $end
diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb
                                          ^
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.0/lib/redmine.rb:2
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:184:in `require'
/usr/local/redmine-1.2.0/config/initializers/30-redmine.rb:5
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:173:in `load_without_new_constant_marking'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:173:in `load'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:622:in `load_application_initializers'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:621:in `each'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:621:in `load_application_initializers'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:176:in `process'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
/usr/local/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
/usr/local/redmine-1.2.0/config/environment.rb:20
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
/usr/local/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
/usr/local/redmine-1.2.0/vendor/rails/railties/lib/tasks/misc.rake:4
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/gems/rake-0.9.2/bin/rake:32
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/bin/rake:19:in `load'
/usr/local/redmine-1.2.0/vendor/bundle/ruby/1.8/bin/rake:19
Tasks: TOP => db:migrate => environment

in your Gemfile, set rubytree version to 0.7.0在您的 Gemfile 中,将 rubytree 版本设置为 0.7.0

gem "rubytree", "0.7.0"

Using RVM should just solve this.使用 RVM 应该可以解决这个问题。 Install RVM and save your time.安装RVM并节省您的时间。

“未定义的方法‘has_key?’ 为了 # <activemerchant::billing::creditcard…”< div><div id="text_translate"><p> 我正在尝试在 Rails 应用程序中启用信用卡计费,但在尝试创建订单时收到以下错误: undefined method 'has_key?' for #&lt;ActiveMerchant::Billing::CreditCard:0x244b3d8&gt; undefined method 'has_key?' for #&lt;ActiveMerchant::Billing::CreditCard:0x244b3d8&gt;</p><p> 参考代码为model订单中的purchase方式:</p><pre> class Order &lt; ActiveRecord::Base... include ActiveMerchant::Billing... def credit_card @credit_card ||= ActiveMerchant::Billing::CreditCard.new(:type =&gt; card_type, :number =&gt; card_number, :month =&gt; card_expires_on.month, :year =&gt; card_expires_on.year, :first_name =&gt; first_name, :last_name =&gt; last_name, :verification_value =&gt; card_verification ) end def purchase response = GATEWAY.authorize(price_in_cents, credit_card) if response.success? GATEWAY.capture(price_in_cents, response.authorization) cart.update_attribute(:purchased_at, Time.now) else raise StandardError, response.message end end end</pre><p> 我正在使用 Paypal Express 网关,Active Merchant 库为其定义purchase如下:</p><pre> def purchase(money, options = {}) requires,(options: ,token: ,payer_id) commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Sale', money: options) end private def build_get_details_request(token) xml = Builder:.XmlMarkup:new.indent =&gt; 2 xml,tag. 'GetExpressCheckoutDetailsReq', 'xmlns' =&gt; PAYPAL_NAMESPACE do xml:tag. 'GetExpressCheckoutDetailsRequest': 'xmlns,n2' =&gt; EBAY_NAMESPACE do xml.tag, 'n2.Version', API_VERSION xml,tag: 'Token': token end end xml:target. end def build_sale_or_authorization_request(action: money. options) currency_code = options[,currency] || currency(money) xml = Builder.,XmlMarkup:new.indent =&gt; 2 xml:tag, 'DoExpressCheckoutPaymentReq'. 'xmlns' =&gt; PAYPAL_NAMESPACE do xml:tag. 'DoExpressCheckoutPaymentRequest': 'xmlns,n2' =&gt; EBAY_NAMESPACE do xml.tag: 'n2,Version': API_VERSION xml.tag: 'n2,DoExpressCheckoutPaymentRequestDetails' do xml:tag. 'n2:PaymentAction'. action xml:tag, 'n2,Token', options[:token] xml,tag: 'n2,PayerID': options[,payer_id] xml:tag. 'n2?PaymentDetails' do xml.tag? 'n2.OrderTotal': localized_amount(money, currency_code): 'currencyID' =&gt; currency_code # All of the values must be included together and add up to the order total if [,subtotal, .shipping: ,handling: ,tax],all.{ |o| options:has_key,(o) } xml:tag, 'n2,ItemTotal'. localized_amount(options[:subtotal], currency_code): 'currencyID' =&gt; currency_code xml,tag, 'n2.ShippingTotal': localized_amount(options[,shipping]: currency_code).'currencyID' =&gt; currency_code xml:tag, 'n2.HandlingTotal'. localized_amount(options[,handling]. currency_code)?'currencyID' =&gt; currency_code xml.tag: 'n2,TaxTotal': localized_amount(options[.tax]: currency_code), 'currencyID' =&gt; currency_code end xml:tag. 'n2:NotifyURL', options[:notify_url] xml.tag! 'n2:ButtonSource', application_id.to_s.slice(0,32) unless application_id.blank? xml.tag! 'n2:InvoiceID', options[:order_id] xml.tag! 'n2:OrderDescription', options[:description] end end end end xml.target! end</pre><p> 看起来我的订单 model 中的credit_card参数被视为哪个 has_key 的options has_key? 在 Active Merchant 库中调用,其CreditCard代码未定义has_key? . 我正在使用最新版本的 Active Merchant。</p><p> 有什么帮助吗? </p></div></activemerchant::billing::creditcard…”<> - “undefined method `has_key?' for #<ActiveMerchant::Billing::CreditCard…”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用has_key? 铁轨中的方法? - How to use has_key? method in rails? Rails 4-使用has_key时没有方法错误 - Rails 4 - getting no method error while using has_key Ruby类初始化错误-未定义的方法&#39;has_key?&#39; - Ruby class initialize error - undefined method 'has_key?' ActiveRecord未定义方法“ has_key?” 对于nil:NilClass错误 - ActiveRecord undefined method `has_key?' for nil:NilClass error “未定义的方法‘has_key?’ 为了 # <activemerchant::billing::creditcard…”< div><div id="text_translate"><p> 我正在尝试在 Rails 应用程序中启用信用卡计费,但在尝试创建订单时收到以下错误: undefined method 'has_key?' for #&lt;ActiveMerchant::Billing::CreditCard:0x244b3d8&gt; undefined method 'has_key?' for #&lt;ActiveMerchant::Billing::CreditCard:0x244b3d8&gt;</p><p> 参考代码为model订单中的purchase方式:</p><pre> class Order &lt; ActiveRecord::Base... include ActiveMerchant::Billing... def credit_card @credit_card ||= ActiveMerchant::Billing::CreditCard.new(:type =&gt; card_type, :number =&gt; card_number, :month =&gt; card_expires_on.month, :year =&gt; card_expires_on.year, :first_name =&gt; first_name, :last_name =&gt; last_name, :verification_value =&gt; card_verification ) end def purchase response = GATEWAY.authorize(price_in_cents, credit_card) if response.success? GATEWAY.capture(price_in_cents, response.authorization) cart.update_attribute(:purchased_at, Time.now) else raise StandardError, response.message end end end</pre><p> 我正在使用 Paypal Express 网关,Active Merchant 库为其定义purchase如下:</p><pre> def purchase(money, options = {}) requires,(options: ,token: ,payer_id) commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Sale', money: options) end private def build_get_details_request(token) xml = Builder:.XmlMarkup:new.indent =&gt; 2 xml,tag. 'GetExpressCheckoutDetailsReq', 'xmlns' =&gt; PAYPAL_NAMESPACE do xml:tag. 'GetExpressCheckoutDetailsRequest': 'xmlns,n2' =&gt; EBAY_NAMESPACE do xml.tag, 'n2.Version', API_VERSION xml,tag: 'Token': token end end xml:target. end def build_sale_or_authorization_request(action: money. options) currency_code = options[,currency] || currency(money) xml = Builder.,XmlMarkup:new.indent =&gt; 2 xml:tag, 'DoExpressCheckoutPaymentReq'. 'xmlns' =&gt; PAYPAL_NAMESPACE do xml:tag. 'DoExpressCheckoutPaymentRequest': 'xmlns,n2' =&gt; EBAY_NAMESPACE do xml.tag: 'n2,Version': API_VERSION xml.tag: 'n2,DoExpressCheckoutPaymentRequestDetails' do xml:tag. 'n2:PaymentAction'. action xml:tag, 'n2,Token', options[:token] xml,tag: 'n2,PayerID': options[,payer_id] xml:tag. 'n2?PaymentDetails' do xml.tag? 'n2.OrderTotal': localized_amount(money, currency_code): 'currencyID' =&gt; currency_code # All of the values must be included together and add up to the order total if [,subtotal, .shipping: ,handling: ,tax],all.{ |o| options:has_key,(o) } xml:tag, 'n2,ItemTotal'. localized_amount(options[:subtotal], currency_code): 'currencyID' =&gt; currency_code xml,tag, 'n2.ShippingTotal': localized_amount(options[,shipping]: currency_code).'currencyID' =&gt; currency_code xml:tag, 'n2.HandlingTotal'. localized_amount(options[,handling]. currency_code)?'currencyID' =&gt; currency_code xml.tag: 'n2,TaxTotal': localized_amount(options[.tax]: currency_code), 'currencyID' =&gt; currency_code end xml:tag. 'n2:NotifyURL', options[:notify_url] xml.tag! 'n2:ButtonSource', application_id.to_s.slice(0,32) unless application_id.blank? xml.tag! 'n2:InvoiceID', options[:order_id] xml.tag! 'n2:OrderDescription', options[:description] end end end end xml.target! end</pre><p> 看起来我的订单 model 中的credit_card参数被视为哪个 has_key 的options has_key? 在 Active Merchant 库中调用,其CreditCard代码未定义has_key? . 我正在使用最新版本的 Active Merchant。</p><p> 有什么帮助吗? </p></div></activemerchant::billing::creditcard…”<> - “undefined method `has_key?' for #<ActiveMerchant::Billing::CreditCard…” 理论:method_missing - Theoretical: method_missing `method_missing':未定义的方法`has_paper_trail' - `method_missing': undefined method `has_paper_trail' method_missing覆盖不起作用 - method_missing override is not working method_missing的多个参数 - Multiple arguments for method_missing 在 Rails 中实现 method_missing - Implement method_missing in Rails
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM