我正在使用rspec和poltergeist / phantomjs测试我的应用程序,在我安装gem friendly_id来更改我的默认路由后,我的所有javascript测试都开始抛出此错误:
Failure/Error: Unable to find matching line from backtrace
ActiveRecord::RecordNotFound:
Couldn't find SelectionProcess with id = assets
我的资产在test.rb中配置:
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
回溯中的最后一行:
# /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/activerecord-3.2.12/lib/active_record/relation/finder_methods.rb:267:in `find_by_attributes'
# /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/activerecord-3.2.12/lib/active_record/dynamic_matchers.rb:50:in `method_missing'
# /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:109:in `find_resource'
# /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:68:in `load_resource_instance'
# /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:32:in `load_resource'
# /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:10:in `block in add_before_filter'
答案 0 :(得分:0)
听起来像friendly_id也在为资产网址而努力。如果为根URL(/)定义friendly_id,则将接管所有资产请求(/ assets)。因此,Rails尝试查找id = assets的记录。