Skip to content

Instantly share code, notes, and snippets.

@kevindayton
Created June 22, 2022 13:23
Show Gist options
  • Save kevindayton/b3fcf34d9aa672e2af50d2e90058c93d to your computer and use it in GitHub Desktop.
Save kevindayton/b3fcf34d9aa672e2af50d2e90058c93d to your computer and use it in GitHub Desktop.
RestUser (ARes model)
class RestUser< ActiveResource::Base
self.include_format_in_path = false
self.format = :json_with_root
ActiveResource::Base.logger = ActiveRecord::Base.logger
self.site = "https://dummyapi.io/data/v1"
self.collection_name = "user"
self.headers['app-id'] = '62a775e08964108a7e6a7ba6'
has_many :posts, class_name: :RestPost
self.schema = {
id: :integer,
title: :string,
first_name: :string,
last_name: :string,
picture: :string,
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment