【问题标题】:Upgrade to Rails 3.2.6 and Routing Error升级到 Rails 3.2.6 和路由错误
【发布时间】:2012-06-22 19:44:02
【问题描述】:

我使用的是 Rails 3.2.3,它运行良好。测试通过。今天我从 Rails 3.2.3 升级到 Rails 3.2.6。

我通过更改 Gemfile 来做到这一点:

我删除

gem 'rails', '3.2.3'

并添加

gem 'rails', '3.2.6'

我运行bundle update。为了看看这是否有效,我运行了我所有的规范测试。我在那里有几个模型,显然所有控制器#show 都失败了。只是控制器#show。这是错误消息:

Failure/Error: get 'show', :id => product.to_param
     ActionController::RoutingError:
       No route matches {:id=>"76", :controller=>"products", :action=>"show"}

这是测试的代码:

let!(:product) { create(:product) }
describe "GET show" do
    it "should assign the requested product as @product" do
      get 'show', :id => product.to_param
      assigns[:product].should == product
    end
  end

我访问了网络上的真实链接,令人惊讶的是,它很好。谁能帮我解决这个问题?

【问题讨论】:

  • 显示其中断部分的语法 .. 它寻找的路线包括 id .. 这条路线在哪里? {:id=>"76", :controller=>"products", :action=>"show"}
  • 这里完全一样的问题,从3.2.5升级到3.2.6。
  • 在这个 SO-post 中回答:stackoverflow.com/questions/11466917/…

标签: ruby-on-rails ruby-on-rails-3 controller gem


【解决方案1】:

这是最新旅程 gem (1.0.4) 的问题 -

要解决这个问题,只需将 Journey gem 的版本锁定为 1.0.3(稳定)

gem "journey", "1.0.3"

【讨论】:

    猜你喜欢
    • 2012-06-19
    • 2012-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多