Forum: Ruby on Rails Doing POST and PUT in a Sinatra application

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Vipul P. (Guest)
on 2009-03-12 07:36

I am using Sinatra to write an application that would act on GET, POST,
PUT and DELETE actions. I have coded the GET part as follows-

get '/' do
    @CNs = Data.all()
    erb :index

The index.erb in ./views has all the rendering logic.

Thus, the get block calls the index.erb file. How should POST and PUT
should be coded ?

post '/addnew/:id' do |id|
    erb :addnew

If addnew.erb will POST and action will be '/addnew/5', then it will
call the post block again, Isn't ?

I think, I shouldn't call the [B]erb :addnew[/B]. Instead something else
should be done.

I am sure this is a very basic thing and a lot of people could have gone
through this step earlier. Any suggestion ?

Thanks in Advance,

+Vipul ;
This topic is locked and can not be replied to.