creating a gem that works for rack based frameworks, not just rails
What are the differences between a typical rails gem and a rack-based framework gem?
Is it just that most o开发者_运维百科f the logic is in the lib
folder and doesn't use rails routes,etc vs using the rack framework?
"Rack-based" simply implies that the gem uses some part of the Rack stack to implement its functionality. For example, the Devise engine uses Rack middleware to plug into Warden, the Rack middleware Rails uses for authentication. This makes it very flexible, and also makes it so that the particular piece of the gem that uses Rack could easily (at least in theory) be ported to other Rack applications.
Note that being Rack-based does not mean that the library can be used with any Rack application; for example, Devise is Rack-based, but also implements some Rails-specific functionality (such as custom models).
精彩评论