# Rest with ruby objects?

**URL:** <https://www.ruby-forum.com/t/rest-with-ruby-objects/169959>\
**Category:** Rails\
**Created:** [June 10, 2009, 6:25pm UTC](https://www.ruby-forum.com/t/rest-with-ruby-objects/169959 "2009-06-10T18:25:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 6:25pm UTC](https://www.ruby-forum.com/t/rest-with-ruby-objects/169959/1 "2009-06-10T18:25:13Z")

</div>

Hello Everyone,

Does anybody know how to use rest to deliver non-active record models  
in rails 2.3.2. I am using flex as a front end for a huge data set  
and I end to crunch the numbers on the back end before passing arrays  
of counts through to the visualisation.

Any help greatly appreciated.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 8:29pm UTC](https://www.ruby-forum.com/t/rest-with-ruby-objects/169959/2 "2009-06-10T20:29:19Z")

</div>

removed\_email\_address@domain.invalid wrote:

> Hello Everyone,
> 
> Does anybody know how to use rest to deliver non-active record models  
> in rails 2.3.2.  
> […]

Just set up a suitable controller (with RESTfully named methods), and  
get the data from wherever you need it. Then send it out as JSON, XML,  
or whatever you need.

REST is really all about naming and conceptual architecture. It doesn’t  
have much directly to do with ActiveRecord.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 8:57pm UTC](https://www.ruby-forum.com/t/rest-with-ruby-objects/169959/3 "2009-06-10T20:57:42Z")

</div>

Thanks for your reply.

How would I get a count without passing an entire array of objects?

j

On Jun 10, 7:29 pm, Marnen Laibow-Koser \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2009, 11:03pm UTC](https://www.ruby-forum.com/t/rest-with-ruby-objects/169959/4 "2009-06-10T23:03:56Z")

</div>

removed\_email\_address@domain.invalid wrote:

> Thanks for your reply.
> 
> How would I get a count without passing an entire array of objects?

Call #size on the array before passing it? Or am I misunderstanding  
what you want?

> j

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 11, 2009, 11:12am UTC](https://www.ruby-forum.com/t/rest-with-ruby-objects/169959/5 "2009-06-11T11:12:46Z")

</div>

Hey Marmen,

Thanks for your reply.  
I want to run several queries aganist a database. These queries will  
return arrays of objects contistong of value, key  
pairs. These objects are not activerecord objects, and basically are  
values I’ll use to create graphs in flex.  
This was very easy with aws. I could use structs, query, build the  
array and serve with aws. But aws is gone.  
I’m having trouble doing this with rest.  
Do I need a count controller, and use list with some parameter to  
specify the query?  
And if I use a simple ruby object I run into XML serialization  
problems.

Have any suggestions on how to go about this?

Thanks again,

j

On Jun 10, 10:03 pm, Marnen Laibow-Koser \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 11, 2009, 12:35pm UTC](https://www.ruby-forum.com/t/rest-with-ruby-objects/169959/6 "2009-06-11T12:35:07Z")

</div>

I haven’t but I will.

Thanks,  
J

On Jun 11,

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 11, 2009, 11:19am UTC](https://www.ruby-forum.com/t/rest-with-ruby-objects/169959/7 "2009-06-11T11:19:14Z")

</div>

Have you had a look at [http://restfulx.github.com](http://restfulx.github.com)?

On Wed, Jun 10, 2009 at 6:24 PM, removed\_email\_address@domain.invalid \<
