0

I am confused about RoR's handling of REST lists.

The Rails 3 routes magic creates (among others)

POST /items create one item
GET  /items list all items

Now, I want to have exactly this PLUS the possibility to POST a list of items (in XML).

What's the best way to do it?

Semantically, POST /items to me sounds about creating a list, not a single item Can I 'overload' this in the controller? Or do I need to create a new routing?

Thanks

1 Answer 1

1

You can code your controller to either accept a single item or an array of them. This isn't in any way reflected in the routes, but only concerns your controller, as POST-parameters are not specified in the routes.

It is accepted (and generally assumed) behavior to accept a single item there. But you are free to accept whatever you like.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.