similar to: help for hash.to_json

Displaying 20 results from an estimated 10000 matches similar to: "help for hash.to_json"

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
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
2006 Jul 11
0
malformed utf-8 character error
Hi, I am using ajax scaffold generator with charset=iso-8859-9(Turkish)... Edit & Create buttons work correctly when there is no turkish chars in the current record. But, if there are turkish chars in any of the fields in the current row, buttons don''t work... (loading indicator simply spinning forever...) I put the KCODE=''u'' line in
2009 Dec 08
0
ActiveSupport 2.3.5 and json 1.2.0 gem
Hey, I''ve tried every trick I can find, yet I''m still unable to get the json gem and ActiveSupport to play nice. No matter in which order I load json and active support, I still end up with: NoMethodError: undefined method `[]'' for #<JSON::Ext::Generator::State:0x104b7fac0> I''m trying to use the JSON object directly, *not* as a ActiveSupport backend:
2007 Sep 28
2
Rails shouldn't output invalid JSON by default
Please check out this ticket (which would explain almost everything): http://dev.rubyonrails.org/ticket/8762 So basically, Rails to_json methods produces invalid JSON out of the box as it doesn''t quote all hash keys. This is valid JSON: { "id": 6589, "code": "SIN", "name": "Singapore" } This is not (Rails'' JSON encoders
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
2010 Aug 26
2
Today: constant JSON::Parser not defined
(Using the latest 3-0-stable and rvm, and ruby-1.9.2-p0) Yesterday everything worked, my own changes are very minor and in the application only. Did anything change that could have caused this problem? Unfortunately simply going back in rails alone to the original "RC2" git-tag did not immediately help, so it may be some other problem (on my own system only, even if I''m
2007 Dec 24
1
Uninitialized constant in integration test
I am seeing weird issues when trying to create integration tests. Here is a very simple example of something that is failing. The assert_redirected_to, and other methods, fail with this or similar exceptions. I have tried requiring both ''application'' and ''listings_controller'', but neither solves this problem, although the exception changes. Anybody know
2007 Dec 13
2
Trying to use ActiveRecord STI but fails
Hi all, I''m wondering about my sanity here. There''s probably something simple I overlooked. First off, I have close to zero experience with Merb. 1. I configured use_orm :activerecord in config/dependencies.rb; 2. I have a file named app/models/measurement.rb which looks like this: class Measurement < Observation end 3. I have another file named
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
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)
2007 Dec 14
3
Issue with upgrading to 2.0 on Leopard? Or something else?
Sorry if this has been covered, but I finally decided to upgrade to Rails 2.0 (running Leopard and previously at rails 1.2.6) so I could start using some of the great new features. I ran the usual "sudo gem install rails --include-dependencies" to upgrade and now my development environment is all out of whack. I suspected MySQL, but I''ve already made sure I was using the
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()
2008 Oct 02
1
acts_as_taggable_on environment issues
Like most people, I''ve got two machines: one for development and one for production. I''ve done everything I can to make sure the ruby/rails environments are the same, but of course they''re not identical (I''ll get into that in a moment). The error that I''m getting happens when I call a method in a background task controller on the production machine; I
2007 Sep 07
3
how to pass an array through url_for.
hi , every one. i just want to generate url from url_for method like this: url_for(:controller=>"users",:action=>"index",:names=>["aotianlong","ayowaya"]) i except it''s generate users?names[]=aotianlong&names[]=ayowaya but it''s generated : users?names=aotianlong%2Fayowaya any idiea ? thank you .
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:
2011 Feb 21
1
authlogic problem
I can''t get authlogic to work. (https://github.com/binarylogic/authlogic) i''ve installed it, i''ve put the following in environment.rb: config.gem "authlogic" ''gem list'' gives: *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.3, 2.0.2) actionpack (3.0.3, 2.0.2) activemodel (3.0.3) activerecord (3.0.3, 2.0.2) activeresource (3.0.3,
2011 Jan 19
6
rake aborted! can't convert Hash into String
Hello, I encouter a problem when i try to do "rake db:migrate": rake aborted! can''t convert Hash into String Here is the trace result: ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! can''t convert Hash into String /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1408:in
2010 Jan 20
1
CRITICAL: Rails 3 error : parser.bundle unhandled exception!!!
kristian-mandrups-macbook-pro:rails3_apps kristianconsult$ rails my_r3 create create README create .gitignore create Rakefile create config.ru create Gemfile create app ... kristian-mandrups-macbook-pro:my_r3 kristianconsult$ script/console /Users/kristianconsult/.gem/ruby/1.8/gems/json-1.1.9/ext/json/ext/ parser.bundle: unhandled exception
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