# Help required

**URL:** <https://www.ruby-forum.com/t/help-required/195802>\
**Category:** Rails\
**Created:** [September 30, 2010, 1:19pm UTC](https://www.ruby-forum.com/t/help-required/195802 "2010-09-30T13:19:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![newb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/2acd7d/32.png) [@newb](https://www.ruby-forum.com/u/newb)\
**Post date:** [September 30, 2010, 1:19pm UTC](https://www.ruby-forum.com/t/help-required/195802/1 "2010-09-30T13:19:25Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![newb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/2acd7d/32.png) [@newb](https://www.ruby-forum.com/u/newb)\
**Post date:** [September 30, 2010, 4:25pm UTC](https://www.ruby-forum.com/t/help-required/195802/2 "2010-09-30T16:25:47Z")

</div>

Newb N. wrote:

> 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…

I’m not sure what you’re really asking, but maybe this will help:

## Terminal

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…

## picture.rb

class Picture \< ActiveRecord::Base  
end

## pictures\_controller.rb

# GET /pictures/1

# GET /pictures/1.xml

def show  
@picture = Picture.find(params[:id])

```
respond_to do |format|
  format.html # show.html.erb
  format.xml { render :xml => @picture }
end

```

end

## Terminal (again)

$ curl [http://localhost:3000/pictures/1.xml](http://localhost:3000/pictures/1.xml)

\<?xml version="1.0" encoding="UTF-8"?\> 2010-09-30T14:14:32Z 1 image/jpeg Fox Example Picture 2010-09-30T14:14:32Z http://images.nationalgeographic.com/wpf/media-live/photos/000/006/cache/red-fox\_679\_600x450.jpg
