I'm receiving a deprecation warning when running rails test
. That warning being below. Any help is appreciated in identifying what I'm doing incorrectly.
(Edit: Side note, the render MUST break and return from the current controller call. I attempted to use ApplicationController.render(...)
in place of the current render
call, but that did not return from the controller call and I was receiving errors/warnings of :no_content rendered
.)
Warning:
DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: actions/action_success.json (called from update at /<path>/app/controllers/table_base_controller.rb:39)
The code throwing the warning is specifically this call to render
within a controller:
render('/actions/action_success.json', locals: {
view: action.lookup_view('default'),
action: action,
area: current_area,
account: current_account
})
I've tried taking off the .json
as directed (also tried adding template: <path>
, tried file: <path>
), however, I receive this error in the test console:
Error:
TableControllerTest#test_Admin_should_update_via_loan_table:
ActionView::MissingTemplate: Missing template actions/action_success with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}. Searched in:
* "/<path>/app/views"
app/controllers/table_base_controller.rb:39:in `update'
app/controllers/application_controller.rb:79:in `with_account'
test/controllers/table_controller_test.rb:14:in `block in <class:TableControllerTest>'
The file in question (path: app/views/actions/action_success.json.jbuilder
):
# frozen_string_literal: true
json.status 'success'
json.status_code 200
json.messages action.messages
if view
json.result do
json.partial! view.to_s, result: action.result, locals: { area: area }
end
else
json.result action.result
end