Re: [Rails] Respond with ID of newly create object and ok status

2015-05-30 Thread Walter Lee Davis
That's Rosie the Racing Poodle. That photo was taken when she was about a year old, and she's 8 or 9 now, but still very friendly and active. She is a very sweet and funny dog, for sure. Walter On May 30, 2015, at 12:14 PM, Taras Matsyk wrote: > Hey, if this is your pet on a profile - then >

Re: [Rails] Respond with ID of newly create object and ok status

2015-05-25 Thread Walter Lee Davis
On May 25, 2015, at 4:15 PM, Taras Matsyk wrote: > Great, it did the trick. > > Thank you, Walter. > > Just one more question, I started googling for differences between JSON > (used in my example) and JSONP format suggested by you. I would > appreciate if you could give a couple of links o

Re: [Rails] Respond with ID of newly create object and ok status

2015-05-25 Thread Walter Lee Davis
I just did this last night, and here's what I used. Note that I send the whole widget back (and use JSONP to add it to the list on my page): def create @widget = Widget.new @widget.update_attributes(widget_params) render json: @widget, callback: params[:callback] end Walter On

[Rails] Respond with ID of newly create object and ok status

2015-05-25 Thread Taras Matsyk
Hi everyone, A client sends a post query which contains all required data to create a Todo except 'id'. From what I know 'id' field will be created when @todo.save is called. So the question is how to inject id (if it is possible and the right way) in to Controlller.create action? Here is what I