similar to: Serializing AR Objects

Displaying 20 results from an estimated 10000 matches similar to: "Serializing AR Objects"

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
2008 Jun 13
3
Alternative to storing ActiveRecord object in session
I''m writing a wizard-like module in my application where, in a series of steps, the user builds upon an ActiveRecord object, and in the end, saves the AR object into the database. The ActiveRecord object is fairly complex, with a has_many association that could potentially get large, so I don''t want to store it directly in the session. In fact, having done so already caused a
2006 May 08
1
Handling "unmarshalable" model object attributes
All, I have an attribute on one of my model objects that cannot be serialized because it contains a Proc. Is there a way for me to mark this attribute as "not to be serialized/unserialized" so that session marshaling/unmarshaling won''t fail? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
2010 Jun 11
2
AR after_initialize quandry
I have a case where I am abstracting the creation of models. After a fair bit of indirection, I eventually get around to making a .new call. I need to be able to pass params to that .new call. I know I can''t use def initialize() in an AR model (rather frustrating). So, I have found some references to after_initialize, but that doesn''t work either. I see several threads on
2008 Jan 04
2
use of Marshal with wxruby classes
Is it possible to use Marshal with wxruby classes to serialize an application''s state? I tried a minimal example of simply serializing a minimal frame object, and I get the error "no marshal_dump is defined for class MinimalFrame". I don''t fully understand this because I also tried another minimal example of dumping a class which did not defined a marshal_dump, and it
2008 Feb 22
2
marshaling ActiveRecord objects: how to unload associations?
I''m marshaling ActiveRecord objects, and I want them to be as small as possible. How can I unload everything that can be reloaded from the database? If they''re marshaled before any of the associations are referenced then the referenced objects aren''t dumped. But if the association has been loaded, how can I unload it? AssociationProxy.reset doesn''t seem to do
2006 Mar 28
1
Newbie question: Dynamic view creation from obj.to_html_form
Hi. I would like to be able to generate a form dynamically from an object''s to_html_form method, submit it, and then place marshalled object into a database row. Since I do not know exactly all the input fields in advance, I figure this would allow me to dynamically create the input form, stuff the user input into object, marshal the object into the database, and display it later
2011 Oct 26
8
IronRuby's Marshal.dump doesn't work with CLR types, or ruby types backed by a CLR type
Backstory: I''m trying to use DRb for some in-house utility code. DRb itself seems to work fine, but I found that when I misspelled a method name, instead of reporting back a NoMethodError, the IronRuby process crashed immediately to the console. This is using a relatively recent build of IronRuby from Github Steps to repro: e = RuntimeError.new ''xyz'' dumped =
2006 Oct 11
5
Marshal Data too short error with ActiveRecord sess. storage
I''m seeing a "marshal data too short" error with an ActiveRecord store for my session data. Other posts say that this happens when the size of the session data exceeds the size of the "data" column in the sessions table. But my "data" column is a TEXT field so it seems unlikely that I could have blown it out. Has anyone else seen "marshal data too
2009 Aug 16
4
How show validation errors in form_remote_tag?
I suspect this has been asked 400 times, but Google yields 2-3 rather complex gymnastics in blogs (and possibly dated), and searching list archives on ruby-forum proves kinda useless. Using standard forms, it''s fairly easy to use @object.errors[:field_name] in the form to embed an error message right next to the field that has the invalid entry. The controller uses a simple conditional
2008 Feb 12
4
Syntax of session's updated_at field ?
What''s the syntax to acquire the updated_at value of a session stored in a db? session.updated_at doesn''t work. can''t find any docs on this. -- gw --~--~---------~--~----~------------~-------~--~----~ 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
2006 Aug 15
20
Talking to Java APIs
I''m trying to figure out how Ruby in general, and/or anything extra Rails may have, can talk to Java APIs of third party server apps. After quite a few search attempts net-wide and on ruby forums, and with "Programming Ruby" in hand, I''m coming up with zilch. Either I''m not finding it, or I''m not recognizing it. I''m assuming there has
2024 Jan 17
1
Choices to remove `srcref` (and its buddies) when serializing objects
On 1/16/24 20:16, Dipterix Wang wrote: > Could you recommend any packages/functions that compute hash such that > the source references and sexpinfo_struct are ignored? Basically a > version of `serialize` that convert R objects to raw without storing > the ancillary source reference and sexpinfo. > I think most people would think of `digest` but that package uses >
2007 Oct 16
2
Where override model attribute names?
OK, so I get that ActiveRecord determines model attributes through reflection of the table schema. Handy for many cases, but not mine. I need to override that and provide my own mapping of attribute names to column names to use the mapped names throughout the application code. I''ve been poking around looking for where in AR''s hierarchy I can can inject this mapping, but
2024 Jan 17
1
Choices to remove `srcref` (and its buddies) when serializing objects
> I think one could implement hashing on the fly without any > serialization, similarly to how identical works, but I am not aware of > any existing implementation We have one in vctrs but it's not exported: https://github.com/r-lib/vctrs/blob/main/src/hash.c The main use is vectorised hashing: ``` # Non-vectorised vctrs:::obj_hash(1:10) #> [1] 1e 77 ce 48 # Vectorised
2008 Jan 09
9
mongrel, monit, and the many, many messages
Monit 4.9, Mongrel 1.0.1, Rails 1.2.6, Mac OS X 10.4.11 (PPC) I don''t know whether this is a mongrel issue or a monit issue. I''m trying to poke my way around a system set up by someone else. I have no more experience w/ mongrel that local Rails dev at this point, and a conceptual understanding of how monit is working. I have the Deploying Rails beta book, and I''m
2007 Nov 29
27
Strip & Sanitize BEFORE saving data
So I''ve googled my brains out, and I see a lot of talk about TextHelper for views, but next to no discussion about cleaning text _before_ it is saved. I figured this had to be asked 4 zillion times, but I''m not finding anything concrete/obvious. Using h is fine as a safety catch, but that alone is not acceptable to me as the means of diffusing the impact of HTML or JS
2007 Oct 11
9
mongrel_rails not starting
os x 10.4.10 used gem to install mongrel 1.0.1. seemed to go w/o errors. "mongrel_rails start -d" spits out this error /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/http11.bundle: Failed to load /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/http11.bundle (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require''
2024 Jan 16
2
Choices to remove `srcref` (and its buddies) when serializing objects
Could you recommend any packages/functions that compute hash such that the source references and sexpinfo_struct are ignored? Basically a version of `serialize` that convert R objects to raw without storing the ancillary source reference and sexpinfo. I think most people would think of `digest` but that package uses `serialize` (see discussion
2007 Nov 04
6
Missing model error
I am storing a shape object in a session, and somewhere I picked up that to make sure I can restore the full glory of Shape, I needed this line in ApplicationController model :Shape So, of course, I also have a file /app/models/shape.rb All was working well, but then I decided I''d rather name the model MyShape. So, I - edited the filename to "my_shape.rb" - edited