与Sinatra设计 [英] Devise with Sinatra

查看:83
本文介绍了与Sinatra设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人用Sinatra安装了 Devise 宝石?

Does anyone had installed Devise gem with Sinatra?

Devise是基于监狱长,所以它应该在Sinatra工作,我找不到有关如何实现它的任何相关信息。

Devise is based on Warden and so it should work on Sinatra, I couldn't find any related info about how to implement it.

推荐答案

Devise真的只是一个以Rails为中心的包装器,有一个很好的帮助者 warden ,这是底层的Rack认证框架。因此,如果您使用Sinatra与Rails一起使用,您可以在Rails应用程序中使用Devise,并在您的Sinatra应用程序中直接使用监护人,他们将看到相同的用户会话数据。

Devise is really just a Rails-centric wrapper with nice helpers for warden, which is the underlying Rack authentication framework. So if you're using Sinatra in conjunction with Rails, you can use Devise in your Rails app, and use warden directly in your Sinatra app, and they will see the same user session data.

所以不,您不能直接在您的Sinatra应用程序中使用Devise,但是如果您正在构建Rails中的一些模块化应用程序以及Sinatra中的其他部分,则可以在组件中使用Devise / Warden 。

So no, you can't use Devise directly within your Sinatra app, but if you're building a modular app with some pieces in Rails, and other pieces in Sinatra, you can use Devise/Warden among the components.

这篇关于与Sinatra设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆