Displaying 20 results from an estimated 1000 matches similar to: "Add custom root option to AR JSON Serializer"
2010 Apr 05
2
Harmonizing JSON/XML serialization
The way Rails handles root nodes in JSON and XML serialization is
inconsistent. This has been discussed before:
https://rails.lighthouseapp.com/projects/8994/tickets/2584-232-activeresource-json-doesnt-send-parameters-with-root-node
This seems mostly taken care of with
ActiveModel::Base.include_root_in_json, especially if/when it ends up
in ActiveResource. However, there is also the issue of how
2008 Mar 24
2
render not able to locate template in publisher
Hi guys,
I have a publisher called UserPublisher setup in models directory of
my app. The reason I have it in a model is because its then possible
for me to invoke publisher methods in after_callbacks of my other
models, just the way we do it for ActionMailer.
My problem is that when I try to update a users profile specifying
location of the view template as a paramater to "profile"
2006 Jul 18
2
Write a new generator
Hi,
Could anyone point me to how to write a generator in Ruby?
I was going through code in ruby files at
\rails-1.1.2\lib\rails_generatorand found that it reads gems
specification to look for generator s present
on the system.
The way there are tutorials on how to create plugins for Rails, are there
any for Generators?
At the end of it I should be able to do something like this
ruby
2006 Nov 04
6
Javascript form validation for In place editting in scriptaculous ?
Is there a way by which I can do form validation for form generated by In
Place Editting of scritaculous?
The reason is, I want to avoid server roundtrip for checks which I can
perform at browser.
Regards,
Jatinder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060828/ca882668/attachment-0001.html
2006 Jul 21
5
Reports in Rails
Hi,
In my rails application I want to include a reporting mechanism that will
allow the users of application to view statistics of various operations
graphically.
Does rails provide inbuilt reporting capabilities? what are different
appraoches I can follow to achieve reporting in rails?
On googling I found following as some of the options,
1.Gruff Graphs for Ruby
2.SVG
3. using Apache FOP.
2006 Apr 25
8
Does Rails suppports XHTML for views for inline SVG''s?
I have following piece of code(which when saved in a file with .xhtml
extension and opened in Mozilla 1.5.0.2 works fine);
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg">
<head>
<title>SVG within XHTML Demo</title>
</head>
<body>
<p> You can embed SVG into XHTML, provided that your
2006 Jun 05
1
starting a non blocking child process
>From a ruby program I would like to start another process which should
continue to run even after the parent process dies.
Is there any way I could achive this?
>From the child process I want to start an instance of SCGI server which
should continue to run even if the parent process dies.
Thanks in Advance,
Jatinder
-------------- next part --------------
An HTML attachment was
2006 May 24
4
AR foreign key problem.
Hello Railslist,
(I''m using RadRails 0.6.3 on Windows XP with Ruby 1.8.4, Rails 1.1 and SQLite3)
I have two tables in the database: "locations" and "customers":
customers.sql
---
id INT PRIMARY KEY
name VARCHAR 255
address VARCHAR 255
postal_code VARCHAR 255
city VARCHAR 255
---
locations.sql
---
id INT PRIMARY KEY
postal_code TEXT
longitude FLOAT
latitude FLOAT
2007 Oct 02
0
More JSON and XML feature parity for AR and ActiveSupport (patch review)
I''m really glad the JSON changes got in, many thanks to all involved,
committers and contributors alike :).
But there''s still one feature that''s missing to achieve feature parity
between the JSON and XML encoding/conversion. And that is the abililty
to say in your controller:
@authors = Author.find(:all)
render :json => @authors.to_json(:only => :name)
2010 Oct 15
0
Why is include_root_in_json true now
I''ve been trying to understand this for a bit now, and I can''t find
any discussion on why the change was made. The default value used to
be false, but now it is true?
When I do something like this it is nice to have the root value:
format.json { render :json => @user }
{"user":{}}
But if I want to output extra variables too it gets annoying to have
the root node
2008 Mar 25
7
Facebooker::Session::SessionExpired (Session key invalid or no longer valid)
Hi All,
I''m having horrible problems with this exception, which seems to happen as
soon as I access the session object. Does anyone know what the path is to
recover from this? This post looked to be the most promising:
http://rubyforge.org/pipermail/facebooker-talk/2007-December/000047.html
And I followed all of the steps except switching my session store, and
modifying the default
2008 Dec 02
2
ActiveResource - xml and json format return different results
Hi,
I''m using Rails 2.1.2. and I wanted to switch ActiveResource format to
JSON and thought that it will work smoothly, but unfortunately it
wasn''t the case.
XML and JSON formats generate different objects:
XML version
#<User:0xb7658440 @prefix_options={}, @attributes={"created_at"=>Mon
Nov 28 11...}>
JSON version
#<User:0xb746af5c @prefix_options={},
2007 Dec 27
5
Rails 2.02 dropped JSON attribute tag ?
Hey there
I was scratching my head over why my application breaks when I run on
a local server but works on my remote server. It turns out that my
local server is Rails 2.0.2 and my remote server is 1.2.3 and I expect
the tag "attributes" to be passed with a json stream, before parsing.
Unfortunately, this was dropped in 2.0.2. Is there any documentation
on this? Any way to get it back?
2006 Jun 16
2
RJS replaces JavaScript?
Hi All,
I am currently devleoping a Rails application and I need to do following as
part of client side operations,
1. HTML Form validations
2. AJAX
I am currently calling Javascript methods from views of my application; I
heard about RJS(Remote Javascripts) templates; are the replacing Javascript
altogether? can I use RJS for HTML Form validations and AJAX?
What I believe is that with RJS
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 =>
2008 Nov 20
0
pass json data into javascript
Hello from a Ruby on Rails beginner!
I''ve been trying to pass some data to a variable in Javascript by using
json. Seems like the Javascript variable doesn''t receive the data
correctly.
This is the code in controller. @courses variable find the data from
database.
class CoursesController < ApplicationController
def index
@courses = Course.find(:all)
end
end
This
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 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
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:
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