1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Editing Your Application and Start the Server

By

3 of 5

Adding an Action

You can add actions directly to app/app.rb, just as you would have added actions to Sinatra projects. There are a number of commented lines in this file. Take a look at them to see some of the things that can be configured. Go to the bottom of the class and (before the end keyword) add the following method. It's very simple, it'll just return the string "Hello World" when a request is made to the /hello URL. If you're familiar with Sinatra, this will be nothing new to you.

get '/hello' do
  "Hello world"
end
  1. About.com
  2. Technology
  3. Ruby
  4. Tutorials
  5. Padrino
  6. Adding an Action

©2014 About.com. All rights reserved.