Search code examples
ruby-on-railsviewrubygemsrails-engines

Rails engine view design to load in the host application


In this tutorial, http://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers, the author created a engine named 'blorgh', then after he finished it, he create a host app named 'unicorn'

He add the blorgh gem with a path, then migrate it,

I just want to ask, is that the 'blorgh:install:migration' will automatically added the view content of the engine 'blorgh' to the host app 'unicorn'? Because in the later part, it seems that the view layout is added in the host app, but in my code it wasn't. (Sorry for being noob).

I just want to know how to add the view layout from the engine to the host app (like how gem devise does it), there are many questions about that, but no clear answers.

Thanks a lot in advance


Solution

  • Instead of:

    blorgh:install:migration
    

    You should:

    rake blorgh:install:migrations
    

    blorgh can share behaviours from your app unicorn. I think you are confused why unicorn dont have any view aticles. The answer is, it is adopted by unicorn app from your blorgh plugin.