ruby on rails - Why does my controller render the wrong view? -
i have 2 controllers, , 1 inherits other:
class firstcontroller < applicationcontroller ... def show ... end end class secondcontroller < firstcontroller ... def show ... end end
the views folder first controller contains following files:
- views/first/show.html.erb
- views/first/show.js.erb
the views folder second controller contains html file:
- views/second/show.html.erb
render or redirect not being called within controller's show
methods.
when call secondcontroller#show
js
, expect views/first/show.js.erb
rendered, not happening. in response: rendered second/show.html.erb
.
if remove file views/second/show.html.erb
, there no problem, , in response rendered first/show.js.erb
. why happening?
what can call js view of parent controller in non-explicit way rendering first/show
?
that's pretty weird. shot in dark, happens if in second controller explicitly tell file render js?
class secondcontroller < firstcontroller def show respond_to |format| format.js { render "first/show.js" } format.html end end end
Comments
Post a Comment