-1

I have an HTML5 website where the user can enter some comments. I have a model in my Rails app and I want to store the uses comments in my app. I am lost as to how should I proceed with it.. I have the basic idea, but not sure how to implement it. Here are the steps which I think are required

  • Append the comment data to a url. something like app.herokuapp.com?params=xxx
  • Create a route to a controller action in my routes file for handling post requests..
  • In my controller action, I need to extract the params and create the entry.

Creating the entry is pretty simple. But I am lost on the routes and extracting the info from the url part. Any Idea or tips? THANKS A LOT.

I have a rails 3.2 app, ruby 1.9.3. Simple javascript/html5/jquery webpages..

1 Answers1

0

Ryan Bates has an excellent screencast in this subject.

bonyiii
  • 2,593
  • 25
  • 25
  • This did solve my next issue.. But I want to know how should I have my routes setup for the POST request. I had "match 'comments/addcomment?:id" => "comments#add" But I get a RoutingError(no routes matched).. Also this seems to be a GET request. Any idea how can I make this a POST? Thanks – user1364813 May 08 '12 at 01:47
  • You need to pass form_authenticity_token http://stackoverflow.com/questions/941594/understand-rails-authenticity-token – bonyiii May 08 '12 at 13:30