On Tue, Oct 25, 2011 at 5:00 PM, Lukas M. wrote:

hm.. no luck with that either. when i try to print out the places object
in the console (logger.debug @place.to_yaml), "address" is missing.
From the top of my head (not hard tested now).
Now you refer to to_yaml, in previous mails, you refered to to_json.

Be careful, there is a fundamental difference between to_xml, to_json,
to_yaml on ActiveRecord ...

One of them (I believe to_yaml) prints the "raw" database column values,
even if you overwrite that accessor function with a name. The other two
(to_json, to_xml IIRC) use the attribute accessors (from ActiveRecord I
presume), that can be overwritten by your own code.

So, I would expect to_yaml to never work in this scenario (where there is
no database column). But to_json should be possible in this scenario
(I did some simple tests with ActiveModel and that seemed to work as
expected).

HTH,

Peter

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 8 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 25, '11 at 1:03p
activeOct 25, '11 at 4:43p
posts8
users5
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase