0

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 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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/…
@Gerry You can distribute an Engine as a Gem; many popular gems like Devise are engines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.