Ruby on Rails 模块、代码共享和社区

发布于 2024-07-27 04:57:43 字数 454 浏览 15 评论 0 原文

序言:我了解宝石。

我在工作中使用 Drupal。 如果您不知道,Drupal 就是模块。 有一个框架和一个核心框架,但是当您在 Drupal 中构建站点时,安装和配置模块是大部分工作。

那么,作为 Rails 新手,我有一个宠物项目,我正在尝试构建一个登录/用户系统。 我已阅读Stack Overflow 上有关此问题的问题

程序是

  1. 安装gems
  2. 编写代码

如果您一年内制作20个网站,其中18个具有相同的登录系统,您可以做什么来最小化第2步?

是否有我不知道的社区支持或活动? 这个配置是否超出约定?

Prologue: I know about gems.

I use Drupal at work. In case you don't know, Drupal is modules. There is a framework and a core framework, but when you build a site in Drupal, installing and configuring modules is most of the work.

So what, being new to Rails, I have a pet project and I am trying to build a login/user system. I've read the question about it here on Stack Overflow.

The procedure is

  1. install gems
  2. write code

If you make 20 websites in a year and 18 have the same login system, what can you do to minimize step 2?

Is there community support or activity I'm not aware of around this? Is this configuration over convention?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

请叫√我孤独 2024-08-03 04:57:43

Rails 有“插件”,它让你模块化得很好。 事实上,当您在应用程序中使用 gem 时,您通常会使用存根插件来从 gem 加载代码。 看看这本书

然后,进一步使用 Rails Engines,它可以让您插入整个应用程序块,而无需大量的额外开销。

请注意,身份验证的标准解决方案实际上是插件。

Rails has "plugins", which let you modularize pretty well. In fact, when you use a gem with your app, you often have a stub plugin to load the code from the gem. Take a look at the book!

Then, take the whole thing a step further to use Rails Engines, which let you plug in whole app chunks without a whole lot of extra overhead.

Note that the standard solutions for authentication are, in fact, plugins.

一笔一画续写前缘 2024-08-03 04:57:43

在 Drupal(4、5 和 6)和 Rails 中完成开发后,我将分享一些观察结果:

  1. Drupal != Rails
    虽然两者都是技术框架,但 Rails 比 Drupal 的固执己见要少得多。 使用 Drupal,您可以获得开箱即用的页面和 UI。 使用 Rails,更多的事情取决于您。

  2. Rails 有多种方式来协助引导/代码重用,包括gemsrails 插件以及现在的 应用程序模板

  3. 还有一些插件可以为您提供比其他插件更多的“优势” - 例如 ActiveScaffold,为您提供功能齐全的管理区域。

不那么固执己见最终会给你带来更大的灵活性和力量。 您可以使用完全不同的身份验证插件 - 例如 AuthLogicRESTful Auth - 并选择最适合您的一个。

我仍然使用并推荐 Drupal 来快速开发网站,其中 Drupal + 开箱即用的模块(具有最少的主题)接近要求。 对于自定义应用程序,Rails 的强大功能 + Ruby 的乐趣意味着它的插件架构是正确的组合:轻巧且功能强大。

Having done development in Drupal (4, 5 & 6) and Rails, I'll share some observations:

  1. Drupal != Rails
    While both are technically frameworks, Rails is much less opinionated than Drupal. With Drupal, you get pages and UI out of the box. With Rails much more of that is up to you.

  2. Rails has multiple ways to assist in bootstrapping / code reuse, including gems, rails plugins and now application templates

  3. There are also some plugins that will give you more of a 'leg up' than others - e.g. ActiveScaffold, which gives you fully-featured admin areas.

Being less opinionated ultimately gives you greater flexibility and power. You can use completely different authentication plugins - say AuthLogic vs RESTful Auth - and choose the one that suits you best.

I still use and recommend Drupal for fast development of sites where Drupal + out-of-the-box modules (with minimal theming) are close to the requirements. For custom applications, the power of Rails + the joy of Ruby mean that its plugin architecture is just the right combination: light and powerful.

眼泪也成诗 2024-08-03 04:57:43

正如吉姆所说,插件就是你所寻求的。 至于能够快速找到有用的插件,请查看我的 Rails 插件目录

As Jim said, plugins are what you are seeking. As for being able to quickly find plugins that can be helpful, check out my Rails plugin directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文