2
3
4
5
6
7
8
9
|
# File 'app/controllers/stay/api/v1/cancellation_policies_controller.rb', line 2
def index
policies = Stay::CancellationPolicy.all
render json: { data:ActiveModelSerializers::SerializableResource.new(policies, each_serializer: CancellationPolicySerializer), success: true }, status: :ok
rescue ActiveRecord::RecordNotFound
render json: { error: "Cancellation policies not found" }, status: :not_found
rescue StandardError => e
render json: { error: "An unexpected error occurred", details: e.message }, status: :internal_server_error
end
|