2013-04-03 75 views
0

我使用rspec和poltergeist/phantomjs測試我的應用程序,並且在安裝了gem friendly_id以更改我的默認路由之後,我的所有javascript測試開始引發此錯誤:找不到型號與id =資產

Failure/Error: Unable to find matching line from backtrace 
    ActiveRecord::RecordNotFound: 
     Couldn't find SelectionProcess with id = assets 

我的資產CONFIGS在test.rb:

config.serve_static_assets = true 
config.static_cache_control = "public, max-age=3600" 

最後行回溯:

# /Users/Augusto/.rvm/gems/[email protected]/gems/activerecord-3.2.12/lib/active_record/relation/finder_methods.rb:267:in `find_by_attributes' 
# /Users/Augusto/.rvm/gems/[email protected]/gems/activerecord-3.2.12/lib/active_record/dynamic_matchers.rb:50:in `method_missing' 
# /Users/Augusto/.rvm/gems/[email protected]/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:109:in `find_resource' 
# /Users/Augusto/.rvm/gems/[email protected]/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:68:in `load_resource_instance' 
# /Users/Augusto/.rvm/gems/[email protected]/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:32:in `load_resource' 
# /Users/Augusto/.rvm/gems/[email protected]/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:10:in `block in add_before_filter' 
+0

你可以添加實際調用'find'方法的部分嗎? – tadman 2013-04-03 19:29:37

回答

0

像friendly_id這樣的聲音也正在爲資產網站踢腳。如果您爲根網址(/)定義friendly_id,則所有資產請求(/資產)將被接管。因此Rails試圖找到id = assets的記錄。