I'd think this would go automatically, as I have already managed to do so for my destroy action, but no JS in activated.
My controller action looks like this:
def visability_toggle
@picture = Picture.find(params[:id])
@picture.toggle! :visable
respond_to do |format|
format.js { render :action => 'visability_toggle' }
end
end
And for now my pictures/_visability_toggle.js.erb
that I would like to match my controller looks like this:
alert('Picture id: #{@picture.id}');
The action itself works. Also this JS is correct and worked when I added it with render js: ...
in the controller action.
As mentioned: I should have left the underscore out when naming my template.