简体   繁体   中英

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. If it is possible, what does the directory structure of the gem look like with javascript and erb files? 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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