samedi 27 juin 2015

What is the best way to store matrix in rails sqlite?

I need to create a new matrix in before_save model method. What is the best way to save this matrix, Dimension of the matrix could be max 50 * 50. How about if I store into Json?

class Simulation < ActiveRecord::Base
  before_save :create_matrix
  belongs_to :user
  validates_presence_of :name, :message => 'Name field cannot be empty..'

  def creat_matrix
    if self.is_matrix
     .....
    end
  end
end

Aucun commentaire:

Enregistrer un commentaire