similar to: serializing / deserializing active records with children

Displaying 20 results from an estimated 10000 matches similar to: "serializing / deserializing active records with children"

2007 Aug 02
0
Deserializing objects in the controller
I''ve an AR model that serializes another object (A), which does not inherit from ActiveRecord::Base. The problem I''m facing is that while A can be deserialized properly in script/console, it deserializes as YAML::Object in the controller. This means that the methods on A are not available on the deserialized instance and I receive NoMethodError messages. I''ve tried to
2011 Mar 26
2
How to deserialize an array from XML
Hi, to serialize an array to xml we can use: an_array = [ 1, 2, 3] an_array.to_xml But to I can''t find a way to convert back XML to array. I didn''t find a method Array.from_xml like Hash.from_xml. Any ideas? Thanks, Gustavo -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email
2008 May 24
1
to_xml for Foo::Bar active records
20 / 20 hind sight, I would probably do things different today but I have most of my active record classes under different parent classes. For example: module Foo class Bar < ActiveRecord::Base ... end end The to_xml for this produces <foo/bar> .... </foo/bar> The / in a tag name is not allowed. Questions: 1) Is this a bug? 2) If so, suggestion of what to convert it to?
2007 Sep 07
0
De-serializing attribute gives YAML::Objects?
I wonder rails 1.2.3 cannot deserialize attribute (objects) correctly but give YAML::Object. Are there any workarounds or tricks to solve the problem? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2005 Dec 28
6
coverage does not work
Hi, I''ve installed coverage (gem install coverage) and try to run tests with -rcoverage option on, but following error occurs: ruby: No such file to load -- coverage (LoadError) I try: ruby -rcoverage mytest.rb 1. I have rubygems in evn var RUBYOPT 2. Gem seems to be installed properly (I can read doc via gems, the files exist in the ../gem/... dirs) Does anyone know what is the
2011 Mar 09
1
ActiveRecord serialize method not returning YAML array in test environment.
Hello, I''ve got a problem with deserialization of AR "serialize" method (http://apidock.com/rails/ActiveRecord/Base/serialize/class) in my tests. It just gives me pure String instead of my data Array. Example: User > AR::Base serialize :roles, Array end Console: u = User.new u.roles = ["admin", "support"] u.save # => true User.first.roles # =>
2006 May 02
0
YAML failing to de-serialize
I''m seeing this same problem that Josh was seeing back on March 23rd (see below) I''ve got the following YAML snippet stored in a text field: "--- !ruby/object:FieldValue \nattributes: \n item_id: 60\n title: Test\n field_id: 15\n created_by_id: 5\n locale: en\n link: www.cclearn.com\n comment: this is a test\n created_at: 2006-05-02 15:43:14.256792 Z\nnew_record:
2006 Jan 17
2
link_to_remote() - can I post data with it???
can I post data with link_to_remote(), link_to() has special option :post => true and viola Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060117/2a0a00af/attachment.html
2008 Jan 20
0
Deserialize JSON post body
I''m doing an HTTP post to my controller with an xml request body: curl -u 53b2c:X -H "Content-Type: text/xml" -v -d "<subscriber><full_name>Alex Egg</full_name><carrier_id>2</ carrier_id><mobile_phone>1234321843</mobile_phone><password>asdf</ password><sub_categories
2018 Sep 06
2
Serializing LLVM IR in custom fashion
Hello. I need to write a pass that converts a whole LLVM module into a bytecode for some other VM. VM's instructions resemble LLVM ones pretty much, so it is almost 1-to-1 translation. Basically, I need to do what BitWriterPass does, but using different format for the resulting bytecode. The obvious solution is just to iterate over all Instructions and serialize them using giant
2007 Mar 28
0
[LLVMdev] "deserialize primitive type 16 (vers=0, pos=15)" with Visual Studio
Seung Jae Lee wrote: > I followed the steps in "Getting Started with the LLVM System using Microsoft Visual Studio" in the document in LLVM page. > > I made hello.c file exactly same shown in the page. > I made hello.bc on UNIX and transferred it to my Windows computer. > And I typed "llc -march=c hello.bc" > (Of course, I downloaded the latest version of LLVM
2007 Mar 28
3
[LLVMdev] "deserialize primitive type 16 (vers=0, pos=15)" with Visual Studio
I followed the steps in "Getting Started with the LLVM System using Microsoft Visual Studio" in the document in LLVM page. I made hello.c file exactly same shown in the page. I made hello.bc on UNIX and transferred it to my Windows computer. And I typed "llc -march=c hello.bc" (Of course, I downloaded the latest version of LLVM and compiled with VS before this.) But my command
2009 Oct 05
0
ActiveRecord Polymorphic Inheritance
I am using RoR ActiveRecord polymorphic inheritance and was wondering if it''s possible to access the base class'' association methods in the invocation of either to_xml or to_json without having to depict the base class data in the serialized string. Here are my classes: # base class class Asset < ActiveRecord::Base belongs_to :resource, :polymorphic => true
2009 Jan 21
3
Nested serialization with to_json and to_xml with array and hash element
Title: Nested serialization with to_json and to_xml with array and hash element class Person < ActiveRecord::Base has_one :address has_one :job def office() return "Executive_Suite" end end class Address < ActiveRecord::Base belongs_to :person end class Job < ActiveRecord::Base belongs_to :person has_one :paygrade def Title return "Engineer" end end
2009 Jan 18
1
Installations fail
Hi! I've tried to install several games in Wine; however, many of them can't even be installed. They should work pretty well according to the AppDB, so it has to be a problem with my computer... The problem comes up as soon as the program starts copying the files. The first few files are copied without any problems, however. OS: Ubuntu 8.10 Wine version: 1.1.13 (I upgraded after it
2006 Jul 10
1
Serializing objects to the database
I have a rails app that has a search mechanism with a bunch of options. I''ve consolidated all the search parameters into a SearchQuery class. Now I want to store searches to be recalled later. I searched the wiki but couldn''t find any pages about how to do this best. I''m worried that if I just serialize the object I won''t be able to change the class without
2005 Dec 26
2
special characters in rhtml
Is there any pattern how to use non-english fonts right in rhtml file? Using &#261; is frustrating. Thanks, Szczepan _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
2007 Feb 21
1
Rendering all the elements when calling Array#to_xml
When I call to_xml on an array, I want it to get the XML for all the elements in it. I''ve defined to_xml in my class. >> r.to_xml => "<video><id>1</id><views>2</views></video>" >> a = [r] => [#<StatisticsReport:0x3259f38 @video_id=1, @views=2>] >> a.to_xml => "<?xml version=\"1.0\"
2006 Jun 22
1
Active Record question, orphaned children
I have a Deck object and a Card object with their corresponding tables. (You know a deck of cards.) When I destory a Deck it leaves orphaned cards in the database. Is there a way to set up the objects with ActiveRecord so that when a parent object is destoryed the child objects are destroyed as well? My code below. class Deck < ActiveRecord::Base has_many :cards end class Card <
2011 May 26
1
serialization of external pointers
Hello, I'm looking for examples of how to handle serialization of external pointers. We use external pointers intensively in Rcpp for modules and one popular request is to have persistence. And I guess we need to be able to serialize/deserialize external pointers for this. Also, module objects are all instances of reference classes, so maybe that can be handled at the R level ? Romain