Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveRecord serialize using JSON instead of YAML

I have a model that uses a serialized column:

class Form < ActiveRecord::Base   serialize :options, Hash end 

Is there a way to make this serialization use JSON instead of YAML?

like image 356
Toby Hede Avatar asked Jan 17 '10 07:01

Toby Hede


1 Answers

In Rails 3.1 you can just

class Form < ActiveRecord::Base   serialize :column, JSON end 

Hope that helps

like image 125
Justas L. Avatar answered Sep 17 '22 19:09

Justas L.