Sha256: 824d0f6f4cb0f593c528fba68da40a09a100568d82a5249b0f4e3f2f941ad0ea
Contents?: true
Size: 692 Bytes
Versions: 10
Compression:
Stored size: 692 Bytes
Contents
require './helper' require 'mongomapper_ext/types/translation' class TranslationEx include MongoMapper::Document key :title, Translation, :default => Translation.build({"es" => "titulo", "en" => "title"}, "en") key :body, Translation, :default => Translation.build({"es" => "contenido", "en" => "content"}, "en") end TranslationEx.delete_all o1 = TranslationEx.create o2 = TranslationEx.create o1.title = "my new title" puts o1.title[:es] o1.title[:es] = "mi nuevo titulo" o1.save puts "languages: #{o1.title.languages.inspect}" puts "default text: #{o1.title}" o1 = TranslationEx.find(o1.id) o2 = TranslationEx.find(o2.id) puts o1.to_mongo.inspect TranslationEx.delete_all
Version data entries
10 entries across 10 versions & 1 rubygems