Hi did anyone used format.json before…
If so pls, do let me know how to use it…
Hi did anyone used format.json before…
If so pls, do let me know how to use it…
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 S. <rails-mailing-l…@andreas-
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs