Skip to content

Commit

Permalink
serializer todo model
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Kabiru committed Jan 10, 2018
1 parent 5bd5f76 commit 580aa8d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ gem 'puma', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'jwt'
gem 'active_model_serializers', '~> 0.10.0'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ GEM
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
active_model_serializers (0.10.0)
actionpack (>= 4.0)
activemodel (>= 4.0)
railties (>= 4.0)
activejob (5.0.1)
activesupport (= 5.0.1)
globalid (>= 0.3.6)
Expand Down Expand Up @@ -156,6 +160,7 @@ PLATFORMS
ruby

DEPENDENCIES
active_model_serializers (~> 0.10.0)
bcrypt (~> 3.1.7)
database_cleaner
factory_girl_rails (~> 4.0)
Expand Down
6 changes: 6 additions & 0 deletions app/serializers/todo_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class TodoSerializer < ActiveModel::Serializer
# attributes to be serialized
attributes :id, :title, :created_at, :updated_at
# model association
has_many :items
end

0 comments on commit 580aa8d

Please sign in to comment.