# RESTful question

**URL:** <https://www.ruby-forum.com/t/restful-question/151092>\
**Category:** Rails\
**Created:** [October 16, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/restful-question/151092 "2008-10-16T18:20:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![digant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4af34b/32.png) [@digant](https://www.ruby-forum.com/u/digant)\
**Post date:** [October 16, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/restful-question/151092/1 "2008-10-16T18:20:02Z")

</div>

I have a restful app which is laid out in true restful fashion. But I  
need a way to dump all the info since the purpose of this app is to  
generate a config file. Do I create a new model and have the index of  
that do the dump? I don’t want to just iterate through the individual  
records with Show bc I do need to run som logic over the sum of data.

So do I just scaffold something called dump and have index of /dump  
output the config file?

---

<div class="post-metadata">

**Author:** ![digant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4af34b/32.png) [@digant](https://www.ruby-forum.com/u/digant)\
**Post date:** [October 16, 2008, 10:58pm UTC](https://www.ruby-forum.com/t/restful-question/151092/2 "2008-10-16T22:58:45Z")

</div>

Oooh… I’m gonna throw my own spin on this and say tha it should not be  
a  
create… but instead a retrieve. While it’s true you might be  
“creating” a  
new dump, you actually want to “GET” the configuration from the system.  
Just like when you request a resource that might be XML,. you don’t  
“create  
a new dump of the objects in xml” , you request them as xml, and you  
call  
@foos.to\_xml, where Rails creates the XML on the fly and renders it.

So…

# routes.rb

map.resource :configuration

# configurations\_controller.rb…

class ConfigurationsController \< ApplicationController

def show  
@some\_model = SomeModel.build\_configuration  
# some rendering to the view, or send\_file, or send\_data or  
whatever  
end

end

That, to me, seems the appropriate method. UNLESS you really are letting  
people create a configuration that you want to persist somewhere for  
later  
retrieval, then the create action might be appropriate. But it sounds  
to me  
like you really are doing a RETRIEVAL, so that sounds like GET  
/configuration

---

<div class="post-metadata">

**Author:** ![digant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4af34b/32.png) [@digant](https://www.ruby-forum.com/u/digant)\
**Post date:** [October 20, 2008, 4:02pm UTC](https://www.ruby-forum.com/t/restful-question/151092/3 "2008-10-20T16:02:30Z")

</div>

On Oct 16, 3:57 pm, “Brian H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Oooh… I’m gonna throw my own spin on this and say tha it should not be a  
> create… but instead a retrieve. While it’s true you might be “creating” a  
> new dump, you actually want to “GET” the configuration from the system.

That’s another good way to look at it.

Jeff

---

<div class="post-metadata">

**Author:** ![digant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4af34b/32.png) [@digant](https://www.ruby-forum.com/u/digant)\
**Post date:** [October 16, 2008, 6:29pm UTC](https://www.ruby-forum.com/t/restful-question/151092/4 "2008-10-16T18:29:14Z")

</div>

On Oct 16, 11:20 am, Digant Kasundra \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> I have a restful app which is laid out in true restful fashion. But I  
> need a way to dump all the info since the purpose of this app is to  
> generate a config file. Do I create a new model and have the index of  
> that do the dump? I don’t want to just iterate through the individual  
> records with Show bc I do need to run som logic over the sum of data.
> 
> ## So do I just scaffold something called dump and have index of /dump output the config file?
> 
> Posted viahttp://www.ruby-forum.com/.

Sounds to me like you want a new controller with a create action to  
generate the config file. That would be restful approach.

Jeff

[purpleworkshops.com](http://purpleworkshops.com)

> **[Hey Daddio!](http://softiesonrails.com)**
>
> Home of Hey Daddio Software
