Many times we are comfortable save to the database data structures like arrays or hashes .
In Ruby on Rails we can do it easily with the method of ActiveRecord
serialize. This method allows you to save objects in a field of the database in text format. Uses YAML to convert the object to text. < ActionController::Base
class Example serialize: data end - Now we can use the class as follows Example:
Using serialize we can save many lines of code)
More information:
http://ar.rubyonrails.org/
Rails: Serialize ActiveRecord method Querying
serialized data in ActiveRecord
0 comments:
Post a Comment