views:

61

answers:

2

So I'm using this plugin: jquery-in-place-editor, I'm trying to make a POST request according to the docs, but I'm not sure what URL to do the POST to, I can't seem to get it right.

If I'm in the show view for the object, which in this case the path is: /quote_line_items/90

But when the script executes I get this error: No action responded to 90. Actions: create, destroy, edit, index, new, show, and update

Which URL would I want to put in the scripts url: parameter?

Update

I just tried this.

$(".editable").editInPlace({
  url: "/quote_line_items/update",
  show_buttons: true
});

And I also tried:

$(".editable").editInPlace({
  url: "/quote_line_items/update/90",
  show_buttons: true
});

just to see what would happen, however, after the form is submitted it shows the show action for that page in an Iframe where the form was, which makes sense I suppose, like it did a GET request or something.

+1  A: 

You probably want to do a post with _method as a parameter having the value update that is if you are doing restful routes.

Otherwise I would point to /quote_line_items/update with a post.

fernyb
hmm... can't get it to work
Joseph Silvashy
I tried this, I dont think that makes sense, like as a URL param? so it'd be `/quote_line_items/update/90?_method=post
Joseph Silvashy
meh, I switched to a different plugin, issue was my nested attrs from within that model. Switching fixed it, but you helped the most.. so uh.. you get a win in the books.
Joseph Silvashy
+1  A: 

It looks like you moved on, but I do have an answer for you.

If quote_line_items is a map.resources, then what you want is a PUT to /quote_line_items/:id jquery-edit-in-place does a post, but what you want is a put, which you can fake with the _method attribute, so try this url: '/quote_line_items/90?_method=put'

Amiel Martin
I like this answer! cool! I'm trying it out right now.
Joseph Silvashy
glad I could help
Amiel Martin