Cross post from SO, hoping to get more insight here.

I've got a column called message in one of my model (UserMessage) in
rails. Now message can contain emoticon value which I passed in from
an iphone app.

For example, the smiley icon has the unicode value of U+1F604 and
since it's passed in with json format, it's serialize to "\u{1F604}"
in my database (postgres).

Now all is fine until I call render :json => @user_message in my
controller. Rails take the serialized message "\u{1F604}" and call
ActiveSupport::JSON.encode on it and therefore encode it again. I've
try to override to_json in the UserMessage class to no avail.

Can someone please point me to the right direction?

--
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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMay 21, '12 at 11:47p
activeMay 21, '12 at 11:47p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Herman: 1 post

People

Translate

site design / logo © 2021 Grokbase