简体   繁体   English

将HTML添加到Ruby on Rails宝石

[英]Adding HTML to a Ruby on Rails Gem

I'm not a RoR expert, trying to write my first gem which includes javascript, erb, etc. Is this possible, it seems like every tutorial and example code I can find only includes ruby code. 我不是RoR专家,我试图写我的第一个gem,其中包括javascript,erb等。这是否可能,似乎我能找到的每个教程和示例代码都只包含ruby代码。 If it is possible, what does the directory structure of the gem look like with javascript and erb files? 如果可能,gem的目录结构与javascript和erb文件是什么样的? Thanks. 谢谢。

What you want is an engine . 您想要的是引擎

Engines can be considered miniature applications that provide functionality to their host applications. 可以将引擎视为为其主机应用程序提供功能的微型应用程序。 A Rails application is actually just a "supercharged" engine, with the Rails::Application class inheriting a lot of its behavior from Rails::Engine. Rails应用程序实际上只是一个“增压”引擎,Rails :: Application类从Rails :: Engine继承了许多行为。

Therefore, engines and applications can be thought of almost the same thing, just with subtle differences, as you'll see throughout this guide. 因此,正如您将在本指南中看到的那样,引擎和应用程序可以被认为几乎是同一件事,只是存在细微的差异。 Engines and applications also share a common structure. 引擎和应用程序也共享相同的结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM