Reputation: 221
I need to create a Rails app that will accept a Post request from a mobile client and store the information sent with the request. I'll be using Ajax to send the request. The request is sent with the following parameters: latitude(float) longitude(float) timestamp(Javascript Date object)
I've already created a data model with the appropriate fields using rails generate resource, but I'm not sure how to get Rails to accept the Post request and create an object with the necessary information. How should I edit the code Rails generated to make this happen?
Thanks, and I apologize for asking such an elementary question.
Upvotes: 4
Views: 5558
Reputation: 1258
Hard to tell how much you know about Rails from this question, but this is all really basic Rails functionality, so you kindof need to start from the beginning... if you do these two tutorials, you'll be able to get started:
Then give it a shot creating a new controller and some routes that match what you're looking for, then you can use a mozilla plugin like RESTClient to test your routes with some dummy data.
But seriously, first step here is "Learn Rails". :)
Upvotes: 5