我正在使用Rails 3.2.0和Devise 2.0.0.rc2。當我運行我的規格時,我收到了一個棄用警告,我沒有看到通常啓動Rails服務器的情況。在運行規範時設計2.0'layout_by_resource'棄用警告
$ rake
.DEPRECATION WARNING: Layout found at "devise" for
DeviseController but parent controller set layout to :layout_by_resource.
Please explicitly set your layout to "devise" or
set it to nil to force a dynamic lookup.
(called from realtime at
/Users/foo/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310)
我/app/controllers/application_controller.rb
樣子:
class ApplicationController < ActionController::Base
protect_from_forgery
layout :layout_by_resource
protected
def layout_by_resource
if devise_controller?
if resource_name == :agent && action_name == 'new'
nil
elsif resource_name == :admin && action_name == 'new'
nil
else
'devise'
end
else
'application'
end
end
end
任何想法,爲什麼我看到這些警告?
這對我有用。 – Drew