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.
1 Answer
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.
2 Comments
Gerry
Unfortunately the senior guy on the project is insisting on making a gem project and not a plugin/engine project. Having a lot of difficulty finding an example gem (or documentation) that includes both javascript and html files, and how to use them. At least this was helpful: gorails.com/episodes/…