similar to: to_json problem (Rails2.2.2)

Displaying 20 results from an estimated 200 matches similar to: "to_json problem (Rails2.2.2)"

2007 Dec 11
0
help for hash.to_json
hi , all under rails 2.0 aotianlong@aotianlong:~/workspace/killer$ ruby script/console Loading development environment (Rails 2.0.1) >> {:user=>"aotianlong"}.to_json => "{\"user\": \"aotianlong\"}" >> user = User.find :first => #<User id: 1, uname: "aotianlong"> >> user.to_json =>
2011 Apr 17
0
newbie: to_json only/except + association confusion
hi, i want to return to_json with ''only'' and also filtered.so i tried various ways, but none of them are really good: A)#OK , but filter missing format.json { render :json => @project.to_json(:only => [:title ], :include=> { :tasks => {:only=>[:id,:title] } } ) } B)#Not OK > filter does not work, format.json { render :json => @project.to_json(:only
2007 Oct 23
2
to_json inconsistency?
Hello, ActiveSupport::JSON::Variable.to_json is the only to_json without an "options" parameter. Is this intended? For example, this code in a .rjs page[@user.dom_id].visual_effect :drop_out, :afterFinish => ActiveSupport::JSON::Variable.new("foo") fails with ActionView::TemplateError: wrong number of arguments (1 for 0) On line #7 of
2013 Jan 07
0
Simplified to_json method API
Sometimes to_json options feels abusing to me: user.to_json(:only => [:id, :name], :methods => [:something]) I would prefer an API like this instead: user.to_json(:id, :name, :something) What do you think about adding a use case like this to to_json? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this
2009 Aug 07
0
How to specify ActiveRecord's to_json encoding
Question: Hi, our company is using Ruby 1.8.6 with Rails 2.2.2. Does anyone know we can explicitly specify what encoding to use when calling to_json() or to_xml() methods? Problem: We have some multibyte characters in our database. For example we have a table with a name column that has this French accented e: Café Records. When we serialize this object using ActiveRecord''s to_xml()
2013 Jan 07
0
Simplified to_json usage
Sometimes default json options feels abusing to me: person.to_json(:only => [:id, :name], :methods => [:something]) I would like to be able to call something like this for AR objects person.to_json(:id, :name, :something) What do you think about extending to_json API with this use case? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2010 Feb 20
1
Advanced use of to_xml and to_json
Hello, I''m working on a Rails app which has a REST API. I manage two formats JSON and XML. Very often to simplify the use if the API, I''m making includes. But when you add params to to_json and to_xml like :only, :except, it''s not only applied on the root object but on all the objects included. Do you know libs or methods to answer to these different problems: * Tell
2008 Jul 12
0
to_json in Rails 2.0.2 not generating proper json?
I am using Rails 2.0.2 and trying to use to_json to generate json. I notice several problems. 1) datetime field such as created_at mapped to "created_at": {} 2) :except does not work, @post.to_json(:except => [:created_at, :updated_at] still gives me "created_at": {}, "update_at": {} 3) problem with escaped char mapping: ''<'' mapped to
2007 Oct 01
0
Patch review requested: #9750 Unambiguous Time, Date and DateTime #to_json format
This patch changes the date format for Time, Date and DateTime #to_json from the ambiguous 10/01/2007 ...to the unambiguous 2007/10/01 http://dev.rubyonrails.org/ticket/9750 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to
2010 Jul 14
3
`stack level too deep` when overwriting `to_json`
I''m using [acts_as_commentable_with_threading](http://github.com/elight/acts_as_commentable_with_threading/), and it worked fine until I tried to overwrite the to_json function to include more details about the associated user. Here''s part of the comment class (which was originally defined in the plugin, but I moved it to the models folder, a move which seems not to affect the
2008 Mar 13
4
AJAX slow - to_json responsible?
Hello. I am building full-ajax back-end, which consits of many quite big partials. As the system grows up, performance is problem. After every click, partial is refreshed, if needed. I am now at 0.5 sec / request. I tried to simply disable ajax and the result was quite suprising: the same page is rendered over 2x faster. I update 80% of page in case of ajax. (Please dont tell: dont use ajax when
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
2007 Mar 24
0
overloading to_json with JSON gem installed causing error
I installed the JSON gem because I wanted the JSON parser. Before installing the JSON gem, overloading worked fine. Before I remove it, I''d like to see if anyone has an idea of what is going on. It''s the only JSON parser I''m aware of, so it would be a bummer if it didn''t work. After installing, if I overload the to_json method in the class, it gives me the
2012 Jan 27
2
to_json performance
Originally posted on github, reported to the right place. I would like to open a discussion about how `to_json` and `as_json` operates in Rails from a performance standpoint. I''m using Rails 3.2 but this issue applies to almost all versions of Rails. Our use case presents the challenge in sending out potentially large JSON (or XML, but we''ll focus on JSON rendering here)
2011 Jan 18
2
how to get captcha image with mechanize ?
Hey, how to get captcha image with mechanize ? the image is not a static picture, it''s a stream, a text-model. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20110118/bf9a58ff/attachment.html>
2017 Dec 28
2
Problem with master password
Hi, I have a problem using the master password feature of dovecot. I'm able to login with the password but then dovecot can't select the INBOX. IMAP test: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN AUTH=DIGEST-MD5 AUTH=SCRAM-SHA-1 AUTH=CRAM-MD5] ITronic Mail Store a login user at itronic.at*admin password a OK
2009 Apr 29
1
Different behaviour on ActiveResorce with JSON or XML
I''m doing a request from a Rails app to another Rails app with ActiveResource. When the format on ActiveResource is XML: Content.find(:all)[0,2].map(&:attributes) => [ {"updated_at"=>Mon Apr 27 15:04:32 UTC 2009, "url"=>"www.google.com", "id"=>1, "created_at"=>Mon Apr 27 15:04:32 UTC 2009},
2006 May 27
5
ActiveSupport JSON working?
Hi, I am trying to convert a hash to JSON using ActiveSupports built in .to_json. I am doing similar to the example below but are there certain strings that could go in place of ''bar'' or ''rez'' that will break the to_json method? I am using a very long string from rjs output in place of ''bar''. Perhaps .to_json is not ready yet? Thanks, Peter
2007 Oct 04
4
2 more JSON / XML feature parity patches before Rails 2.0
I''d really like to see just 2 more functional changes to the JSON serialization/encoding before we get to Rails 2.0. First, and I think this is really crucial because without it all the efforts to output JSON from ActiveRecord objects would have been half in vain, is to allow us to do this in controllers: @authors = Author.find(:all) render :json => @authors.to_json(:only =>
2012 Jan 25
4
serializable_hash and serializable_add_includes
I''m trying to write a helper method similar to attr_accessible but instead it will be used to whitelist which attributes are available for serialization (attr_serializable). My first attempt at this was to override serialized_hash and modify the :only option to include nothing but serializable attributes. I''m facing a problem when nested models are ''included''