Sinatra and Ruby forms -


i apologise basic new writing ruby. i'm trying send simple form posts page not know how retrieve it.

here's app.rb

#app.rb require 'rubygems' require 'sinatra' require 'shotgun' tilt.register tilt::erbtemplate, 'html.erb'  '/'   @title = "home page"   erb :index end  post '/post'   body = params[:body]   erb :post end 

and here's index.html.erb

<h1>wiki</h1>  <form action="/post" method="post">     <input type="text" name="message">     <input type="submit">   </form> 

do need add views posts page?

you using wrong key params variable. simple way see being passed in params variable in request put like:

#app.rb before   puts '[params]'   p params end 

then can see in terminal being passed.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -