开发者

authlogic single access token

I am using Single access token to do some data transfer, so far I got it to work with one action in the controller through

ProjectsController

private

def single_access_allowed?
  action_name == 'index'
end

But I need two more actions to be allowed access with single access token, I tried to modify the line action_name == 'index' to action_name == ['index', 'update', 'destroy'] but to no avail. I have tried to look for the single_access_allowed? definition in all of the files in authlogic's gem directory, but it doesn't say what sort of 开发者_StackOverflow中文版variable action_name is, e.g., array, hash, string?

Any help would be great!

Thanks!


action_name is a string. You want to check if action_name is within a list of actions (an array of strings). To do this in ruby:

def single_access_allowed?
  ["index","update","destroy"].include?(action_name)
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜