A link to the api docs may get you started:
http://api.rubyonrails.org/classes/ActiveResource/Base.html#M000827
Also look at the code generated with scaffold. I simply added a json
format.
def index
@sites = Site.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @sites.to_xml }
format.json { render :json => @sites.to_json }
end
end
These are called with the URL:
http://somesite.org/index.html
http://somesite.org/index.xml
http://somesite.org/index.json
HTH
-Dave
On Dec 7, 3:19 am, Ratnavel Sundaramurthi <rails-mailing-l...@andreas-
s.net> wrote:> Hi did anyone usedformat.jsonbefore..
>
> If so pls, do let me know how to use it....
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---