Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Add Fast JSON Api #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gem "grape"
gem "grape-active_model_serializers"
gem "grape-swagger"
gem "grape-swagger-rails"
gem "grape_fast_jsonapi"
gem "jbuilder", "~> 2.5"
gem "pg", ">= 0.18", "< 2.0"
gem "puma", "~> 3.11"
Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ GEM
equalizer (0.0.11)
erubi (1.7.1)
execjs (2.7.0)
fast_jsonapi (1.5)
activesupport (>= 4.2)
ffi (1.9.25)
globalid (0.4.1)
activesupport (>= 4.2.0)
Expand All @@ -129,6 +131,9 @@ GEM
grape (>= 0.16.2)
grape-swagger-rails (0.3.0)
railties (>= 3.2.12)
grape_fast_jsonapi (0.1.0)
fast_jsonapi
grape
haml (5.0.4)
temple (>= 0.8.0)
tilt
Expand Down Expand Up @@ -325,6 +330,7 @@ DEPENDENCIES
grape-active_model_serializers
grape-swagger
grape-swagger-rails
grape_fast_jsonapi
haml-lint
jbuilder (~> 2.5)
letter_opener_web
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Defaults
default_format :json
format :json
formatter :json,
Grape::Formatter::ActiveModelSerializers
Grape::Formatter::FastJsonapi

helpers do
def permitted_params
Expand Down
3 changes: 2 additions & 1 deletion app/serializers/user_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class UserSerializer < ActiveModel::Serializer
class UserSerializer
include FastJsonapi::ObjectSerializer
attributes :id, :username, :email, :last_seen,
:last_sign_in_ip, :sign_in_count,
:created_at, :updated_at
Expand Down