diff --git a/lib/rails_admin/config/actions/show.rb b/lib/rails_admin/config/actions/show.rb index 18d587399..6187a371a 100644 --- a/lib/rails_admin/config/actions/show.rb +++ b/lib/rails_admin/config/actions/show.rb @@ -21,8 +21,8 @@ class Show < RailsAdmin::Config::Actions::Base register_instance_option :controller do proc do respond_to do |format| - format.json { render json: @object } format.html { render @action.template_name } + format.json { render json: @object } end end end diff --git a/spec/integration/actions/show_spec.rb b/spec/integration/actions/show_spec.rb index c08b3619a..881c8d49e 100644 --- a/spec/integration/actions/show_spec.rb +++ b/spec/integration/actions/show_spec.rb @@ -47,6 +47,16 @@ end end + context 'with default format' do + it 'responds with HTML' do + page.driver.options[:headers] = {'HTTP_ACCEPT' => '*/*'} + visit show_path(model_name: 'team', id: team.id) + + response_type = Mime::Type.parse(response_headers['Content-Type']).first + expect(response_type).to be_html + end + end + context 'when compact_show_view is enabled' do it 'hides nil fields in show view by default' do visit show_path(model_name: 'team', id: team.id)