1) Views structure
Assuming I have two sets of views, set A and set B.
Both sets are similar having the view index.html.erb
and the partials _index.html.erb
, _new.html.erb
, _edit.html.erb
, _table.html.erb
, _show.html.erb
, _bean.html.erb
, _form.html.erb
, and _field.html.erb
.
2) Relationship between views
Both also have a similar format where index.html.erb
view renders partial _index.html.erb
;
The partial _index.html.erb
renders partials _new.html.erb
, _edit.html.erb
, _table.html.erb
, _show.html.erb
;
Both partial _edit.html.erb
and _new.html.erb
render partial _form.html.erb
;
The partial _form.html.erb
redenizes the partial _fiels.html.erb
;
And partials _show.html.erb
and _table.html.erb
rederize to partial _bean.html.erb
.
3) Relationship between the two groups of views
But in my logic, object A has a one-to-many relationship with object B, and view a/index
also renders partial b/_index
.
4) Problem
When implementing the following code render partial: 'b/index'
into a/index.html.erb
the content of the b/_index.html.erb
file is inserted correctly, however it renders the partials of the a
folder and not the b
folder. Example: a/_show.html.erb
is rendered instead of b/_show.html.erb
.
5) Doubt
But how can I determine the partial to be rendered, based on the partial directory that referenced it instead of the current view's directory?