user3906755
user3906755

Reputation: 123

Rails Engine not loading from gemfile

Hello I am new to Rails Engine , I have followed ruby official documentation for "Creating Rails Engine" http://guides.rubyonrails.org/engines.html After creating Plugin I have added plugin name in gemfile to load the engine

gem 'product_search', :path => 'product_search/engines/product_search'

but it always through error The path /var/www/sites/web_service/product_search/engines/product_search does not exist.

The Plugin name is "ProductSearch" I have also changes the pathname

gem 'product_search', :path => 'ProductSearch/engines/product_search'

[It is the Directory structure of the plugin:]

https://i.sstatic.net/hRh1X.png

Thanks in advance..!!!

Upvotes: 0

Views: 702

Answers (1)

Roman Kiselenko
Roman Kiselenko

Reputation: 44370

From the documentation:

At the root of this brand new engine's directory lives a blorgh.gemspec file. When you include the engine into an application later on, you will do so with this line in the Rails application's Gemfile:

gem 'blorgh', path: "vendor/engines/blorgh"

Don't forget to run bundle install as usual. By specifying it as a gem within the Gemfile, Bundler will load it as such, parsing this blorgh.gemspec file and requiring a file within the lib directory called lib/blorgh.rb. This file requires the blorgh/engine.rb file (located at lib/blorgh/engine.rb) and defines a base module called Blorgh.

Upvotes: 2

Related Questions