Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Rails3中,如何在只对json格式进行过滤之前跳过_?_Json_Ruby On Rails 3_Devise_Ruby On Rails 3.2_Rabl - Fatal编程技术网

在Rails3中,如何在只对json格式进行过滤之前跳过_?

在Rails3中,如何在只对json格式进行过滤之前跳过_?,json,ruby-on-rails-3,devise,ruby-on-rails-3.2,rabl,Json,Ruby On Rails 3,Devise,Ruby On Rails 3.2,Rabl,如果格式为uujson而非html,如何在索引的u过滤器之前跳过u并仅显示控制器? 差不多 skip_before_filter :authenticate_user!, :only => [:index, :show, :format => :json] 我使用的是rails 3.2。谢谢。试试看 skip_before_filter :authenticate_user!, :only => [:index, :show] , :if => request.co

如果格式为uujson而非html,如何在索引的u过滤器之前跳过u并仅显示控制器? 差不多

skip_before_filter :authenticate_user!, :only => [:index, :show, :format => :json] 
我使用的是rails 3.2。谢谢。

试试看

skip_before_filter :authenticate_user!, :only => [:index, :show] , :if =>
 request.content_type == "json"
试试这个

在筛选之前跳过筛选:验证用户!,:仅=>[:索引,:显示],:如果=>
request.format.json?==是的

谢谢你的回复。还有其他方法吗?请尝试在筛选之前跳过筛选:验证用户!,:only=>[:index,:show],:if=>proc{c|request.xhr}