Active Model Serializers + Tire (Beta)
The easy way to add Active Model Serializers to your Tire results.
Installation
Drop this line to your application's Gemfile:
gem 'tire-am_serializers'
Usage
Same as Active Model Serializers:
render json: User.search(...)
There is only one thing, Rails will look for TireUserSeralizer
by default. If class doesn't exist, it will try to find UserSerailizer
. If no Serilaizers present for this model, it will use default behaviour of to_json
.
If you want to get old behaviour from Tire:
render json: Vacancy.search("*").to_json
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request