nigelpegg/auth_basics — Issue #25: need a bulk book_tag poster
Author: nigelpegg
Created: 2011-12-08 23:46:17+00:00
State: open

a book can have N book_tags, each one comprised of a name and value pair (eg: "subject":"plumbing", "category":"books we love"). This gives us a ton of flexibility to tag stuff as we see fit.

A traditional way to create a tag would be with a tags_controller POST, but this means N POSTs, which is a little unnecessary.

Proposal : we take POSTs /books/:bookID/tags in 2 different ways - the controller needs to figure it out based on the params :

PARAMS VARIANT 1 : simply creates 1 new tag for the book:
{remote:true, utf8:"check", format:"json", tag:{name:"foo", value:"bar"}}

PARAMS VARIANT 2 : bulk-create multiple tags
{remote:true, utf8:"check", format:"json", tags:[{name:"foo", value:"bar"}, {name:"foo", value:"bar"}]}

Note the plural "tags" and array of name-value pairs in variant 2.