0.0
No commit activity in last 3 years
No release in over 3 years
Serializes Activemodel object to JSON API format
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 5.0
~> 10.0
 Project Readme

MiniSerializer

Serialize object for export json api

Installation

Add this line to your application's Gemfile:

 gem 'mini_serializer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mini_serializer

Usage

Initialize

serializer=MiniSerializer::Serializer.new(House.all)

Initialize with except params

serializer=MiniSerializer::Serializer.new(House.all,{except:[:id,:title]})

Associations

serializer.add_has_many('house_images',['id','house_id','created_at','updated_at'])

serializer.add_has_one('house_type',['id'])

Parse data with json_serializer

render json:serializer.json_serializer

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mhi20/mini_serializer.

License

The gem is available as open source under the terms of the MIT License.