小编cbe*_*eer的帖子

覆盖Rails 3 Engines提供的命名路由

我正在使用Rails引擎的Ruby on Rails 3(.0)应用程序.但是,在我的本地应用程序中,我想覆盖Rails引擎提供的其中一个路由.

从引擎config/routes.rb:

match 'their_named_route' => 'controller#action', :as => 'the_route'
Run Code Online (Sandbox Code Playgroud)

从我的应用程序config/routes.rb:

match 'my_named_route' => 'controller#action', :as => 'the_route'
Run Code Online (Sandbox Code Playgroud)

但是,当我检查路线时,两者似乎都是活动的(并且它们的路线似乎"赢",至少在发动机控制器内)

$ rake routes
the_route  /my_named_route(.:format)    {:controller=>"controller", :action=>"action"}
the_route  /their_named_route(.:format) {:controller=>"controller", :action=>"action"}
Run Code Online (Sandbox Code Playgroud)

有没有一种方法可以强制我的本地应用程序的命名路由优先?

routes ruby-on-rails rails-engines ruby-on-rails-3

9
推荐指数
2
解决办法
5645
查看次数

有关Bundle Install的信息

我正在运行ruby 1.9.3-p125和rails 3.2.6.当我跑bundle install,我得到错误:

 Could not find addressable-2.3.1 in any of the sources
Run Code Online (Sandbox Code Playgroud)

我的Gemfile.lock包含"可寻址(2.3.1)",但它不是我的应用程序的显式依赖项.为什么会这样,我该如何解决?

ruby bundle

3
推荐指数
1
解决办法
1882
查看次数