# Acquiring data from non-pair POST params

**URL:** <https://www.ruby-forum.com/t/acquiring-data-from-non-pair-post-params/126277>\
**Category:** Rails\
**Created:** [January 16, 2008, 11:20pm UTC](https://www.ruby-forum.com/t/acquiring-data-from-non-pair-post-params/126277 "2008-01-16T23:20:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [January 16, 2008, 11:20pm UTC](https://www.ruby-forum.com/t/acquiring-data-from-non-pair-post-params/126277/1 "2008-01-16T23:20:03Z")

</div>

Screwy title, but what I am trying to do is…

I have an incoming POST to a typical Rails /:controller/:action url.

That post has one value, not a name-value pair. So, Rail’s params has  
that data as a key (along with the other stuff Rails adds to params).  
Now, in my current fiddling, it can be extracted as params.keys[0] –  
but I don’t think I can count on that position as the params hash is,  
well, a hash.

Is there a better way to acquire this data?

– gw

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [January 16, 2008, 11:30pm UTC](https://www.ruby-forum.com/t/acquiring-data-from-non-pair-post-params/126277/2 "2008-01-16T23:30:19Z")

</div>

On 16 Jan 2008, at 22:20, Greg W. wrote:

> Is there a better way to acquire this data?  
> look at request.raw\_post ?

Fred

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [January 16, 2008, 11:39pm UTC](https://www.ruby-forum.com/t/acquiring-data-from-non-pair-post-params/126277/3 "2008-01-16T23:39:45Z")

</div>

Frederick C. wrote:

> On 16 Jan 2008, at 22:20, Greg W. wrote:
> 
> > Is there a better way to acquire this data?  
> > look at request.raw\_post ?

Perfect. Thanks, Fred.

– gw

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [January 16, 2008, 11:54pm UTC](https://www.ruby-forum.com/t/acquiring-data-from-non-pair-post-params/126277/4 "2008-01-16T23:54:30Z")

</div>

On Jan 16, 2008, at 4:20 PM, Greg W. wrote:

> Is there a better way to acquire this data?

Hi Greg,

I did something like this:

[http://localhost:3000/my\_controller/my\_action/success](http://localhost:3000/my_controller/my_action/success)

and in the controller, params[:id] == ‘success’

I’m pretty sure that works because

[http://localhost:3000/my\_controller/my\_action/1](http://localhost:3000/my_controller/my_action/1)

the 1 gets mapped to :id automatically. That was my reasoning  
anyway, and so far it has worked correctly. I don’t know if that will  
work for you or not. And I’m not using any special/custom routing.  
Just the plain stuff that Rails 1.2.3 defines.

Peace,  
Phillip
