Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.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
Ruby on rails 声明性_授权Gem不适用于JSON/XML请求_Ruby On Rails_Ruby_Ruby On Rails 4_Declarative Authorization - Fatal编程技术网

Ruby on rails 声明性_授权Gem不适用于JSON/XML请求

Ruby on rails 声明性_授权Gem不适用于JSON/XML请求,ruby-on-rails,ruby,ruby-on-rails-4,declarative-authorization,Ruby On Rails,Ruby,Ruby On Rails 4,Declarative Authorization,Rails有点新。Im目前正在使用rails 4.1.8和声明性的_授权gem。当我从标准浏览器调用一个受保护的URL时,我会收到预期的“未授权”错误,这是我在系统中编程的错误。如果我从邮递员那里调用相同的url,我就会得到我的数据 不知何故,Rails似乎忽略了声明性的_授权,或者它无法处理头设置为除accept text/html之外的任何内容 我的代码如下: 样本控制器。我正在使用filter\u access\u to:all class ShiftsController < Ap

Rails有点新。Im目前正在使用rails 4.1.8和声明性的_授权gem。当我从标准浏览器调用一个受保护的URL时,我会收到预期的“未授权”错误,这是我在系统中编程的错误。如果我从邮递员那里调用相同的url,我就会得到我的数据

不知何故,Rails似乎忽略了声明性的_授权,或者它无法处理头设置为除accept text/html之外的任何内容

我的代码如下: 样本控制器。我正在使用
filter\u access\u to:all

class ShiftsController < ApplicationController
protect_from_forgery with: :null_session 
filter_access_to :all

 def index
     qrtStr = 'shift_date between :from and :end'
     if params.has_key?(:from)
       parm = {:from => params[:from]}
     else
       parm = {:from => (Time.now.midnight - 30.day)}
     end
routes.rb:

resources :shifts, except: [:new, :edit] do
  patch 'submit', on: :member
  patch 'acquire', on: :member
end
我错过了什么??还是声明性的_授权不能正确地与rails 4.1.8配合使用


非常感谢他们的
.travis.yml
表明他们只测试Ruby 1.8.7和1.9.3,如果你使用的是较新的Ruby,那么你就在未知之地。您最好找到一个更积极维护的gem。

谢谢,我确实在使用ruby 2.1.5p273。我要把那件事记在我的帐上。真遗憾,我喜欢创业板处理政策的方式。
resources :shifts, except: [:new, :edit] do
  patch 'submit', on: :member
  patch 'acquire', on: :member
end