Tuesday, April 17, 2007

Game Where U Can Get Pregnant

Create controllers and views in Ruby on Rails plugins


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:
Ejemplo.create eg = (: data => {'key1' = > 'attribute1', 'key2' => 2}) puts ej.datos ['key2']

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