Dear all
Actually I would like to know how to send the picture name in the xml
response
fox example picture = Picture.find(params[:id])
Here i need to send the picture.id in the xml response…
Please tell me that how can i go with it…
Dear all
Actually I would like to know how to send the picture name in the xml
response
fox example picture = Picture.find(params[:id])
Here i need to send the picture.id in the xml response…
Please tell me that how can i go with it…
Newb N. wrote:
Actually I would like to know how to send the picture name in the xml
responsefox example picture = Picture.find(params[:id])
Here i need to send the picture.id in the xml response…
I’m not sure what you’re really asking, but maybe this will help:
rails g scaffold picture name:string mime_type:string url:string
rake db:migrate
rails s (or ./script/server for Rails < 3.0)
THE CODE…
class Picture < ActiveRecord::Base
end
def show
@picture = Picture.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @picture }
end
end
$ curl http://localhost:3000/pictures/1.xml
<?xml version="1.0" encoding="UTF-8"?>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