No commit activity in last 3 years
No release in over 3 years
ActiveRecord JSON serializer
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 3.0.0

Runtime

< 5, >= 3.2.13
>= 2.0.5
 Project Readme

ActiveRecord Json Serialize

Coverage StatusBuild StatusGem VersionCode Climate

ActiveRecord JSON serializer

Installation

Add this line to your application's Gemfile:

gem 'ar_json_serialize'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ar_json_serialize

Usage

You need to have some text field for storing some specific data in Hash/Array/etc inside you model.

Add next string in your ActiveRecord model:

class Promo < ActiveRecord::Base
  json_serialize :test_column
end

You can set value of this column with any object.

promo = ::Promo.new
promo.test_column = {'key1' => 'value1'}
promo.save!

And use it with full power of Hashie!

promo = ::Promo.last
puts "Our value is #{promo.test_column.key1}"

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request