Class: Stay::Api::V1::BedTypesController

Inherits:
BaseApiController
  • Object
show all
Defined in:
app/controllers/stay/api/v1/bed_types_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
# File 'app/controllers/stay/api/v1/bed_types_controller.rb', line 4

def index
  @bed_type = Stay::BedType.all
  return render json: { error: "no data found", success: false }, status: :unprocessable_entity unless @bed_type.any?
  render json: { message: "bed type found", data:  ActiveModelSerializers::SerializableResource.new(@bed_type, each_serializer: BedTypeSerializer), success: true }, status: :ok
end