作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
迁移到 Rails 3 后,我遇到了这个问题
undefined method `reverse_merge' for nil:NilClass
activesupport (3.0.7) lib/active_support/whiny_nil.rb:48:in `method_missing'
actionpack (3.0.7) lib/action_controller/metal/url_for.rb:8:in `url_options'
actionpack (3.0.7) lib/action_dispatch/routing/url_for.rb:131:in `url_for'
actionpack (3.0.7) lib/action_dispatch/routing/route_set.rb:195:in `frontend_path'
lib/my_own_login.rb:97:in `login_required'
activesupport (3.0.7) lib/active_support/callbacks.rb:457:in `_run__1711026059__process_action__199225275__callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:410:in `send'
activesupport (3.0.7) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `send'
activesupport (3.0.7) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.7) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.7) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.7) lib/active_support/notifications.rb:52:in `instrument'
if params[:mode].to_i == 1
redirect_to root_path
else params[:mode].to_i == 2
redirect_to frontend_path #Line 97
end
match "/account" => "account#index", :via => :get, :as => :frontend
rake routes | grep frontend
frontend GET /account(.:format) {:action=>"index", :controller=>"account"}
最佳答案
我修复了错误。问题出在以下代码中:
def default_url_options(options={})
{ :org_code => current_organisation.custom_url } if !current_organisation.blank? && !current_organisation.custom_url.blank?
end
def default_url_options(options={})
if !current_organisation.blank? && !current_organisation.custom_url.blank?
{ :org_code => current_organisation.custom_url }
else
{}
end
end
关于ruby-on-rails - 迁移到 rails 3 后未定义方法 `reverse_merge' 为 nil :NilClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6841094/
ruby-1.9.2-p180 :007 > a = {:a => 10, :b => 20} => {:a=>10, :b=>20} ruby-1.9.2-p180 :008 > a.revers
两者都可以 def setup(options = {}) options.reverse_merge :size => 25, :velocity => 10 end 和 def setup(o
迁移到 Rails 3 后,我遇到了这个问题 undefined method `reverse_merge' for nil:NilClass activesupport (3.0.7) lib/a
我是一名优秀的程序员,十分优秀!