Partially use engine rails in the application

I use a mounted rail mechanism called "Child" inside an application called "Parent" .

I have partial 'child / user / _index.html.erb'

Now I want to render this child in the parent controller . Is it possible?

So I want to do something like

render :partial => 'child/user/index.html.erb' 

thanks

+4
source share
3 answers

Ref this

 render :file => 'child/user/index.html.erb' ###or try '/child/user/index.html.erb' 
+4
source

I think you can just render user/index

ref http://edgeguides.rubyonrails.org/engines.html

The engine cannot find the part necessary for rendering Comments. Rails looks first in the app (views / dummy) app / views, and then in the engine’s applications / views directory. when he cannot find him, he will throw this error. The engine knows how to look for blorgh / comments / comment, because the model object that it receives from the Blorgh :: Comment class.

0
source

This worked for me:

 render file: 'child/user/_index.html.erb' 
0
source

Source: https://habr.com/ru/post/1435037/


All Articles