If I delete in Gemfile line:
gem 'jbuilder'
it returns:
Completed 204 No Content
when I try to run http://localhost:3000/api/v1/customers/1 in browser
Some files:
# routes.rb
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :customers
end
end
end
# app/controllers/application_controller.rb
class ApplicationController < ActionController::API
include ActionView::Rendering
end
# app/controllers/api_controller.rb
class ApiController < ApplicationController
before_action :set_default_format
private
def set_default_format
request.format = :json
end
end
# app/controllers/api/v1/customers_controller.rb
class Api::V1::CustomersController < ApiController
before_action :set_customer, only: [:show, :update, :destroy]
def show
end
private
def set_customer
@customer = Customer.find(params[:id])
end
end
# app/views/api/v1/customers/show.json.jb
json = {
id: @customer.id,
name: @customer.name
}
json
If I delete in Gemfile line:
gem 'jbuilder'
it returns:Completed 204 No Content
when I try to runhttp://localhost:3000/api/v1/customers/1
in browserSome files: