I need a generic js (view) answer, which I visualize from a group of controllers. He lives in app/views/shared/success.js.erb.
This is the standard answer for most of my controllers, which modifies the DOM with some content. However, this content refers to the controller that runs it.
The problem is that I cannot figure out how to allow the view path for a specific controller from this general js view. He is an example (includes some controllers with names)
class UsersController < ActionController::Base
def create
render 'shared/success'
end
end
class Settings::PermissionsController < ActionController::Base
def create
render 'shared/success'
end
end
<p>Some View code that only relates to <strong>users</strong></p>
<p>Some View code that only relates to <strong>permission settings</strong></p>
var listItem = '<%= j render "#{insert resolved path to this particular controller instance}/success.html.erb" %>'
$(".list").append(listItem);
The reason I want to do this is because the js answer is always the same, it is just a change of content. Any thoughts on how I can get the current rendering path of the controller's default view?
source