sam / harbor

Harbor is a Ruby Web Framework.
https://github.com/sam/harbor
MIT License
3 stars 6 forks source link

Add CRUD helper routes #25

Closed sam closed 12 years ago

sam commented 12 years ago

Add short-cuts in Controller for CRUD helper routes:

class Example < Harbor::Application
  class Home < Harbor::Controller

    index do
      response.puts "Welcome home!"
    end

    show do |id|
      response.puts "You asked me to show #{id}"
    end

    update do |id|
      response.puts "Aight, stand back, I've got this! (#{id})"
    end

    delete do |id|
      response.puts "#{id} is going down!"
    end

  end # Controller: Home
end # Application: Example

Note:

sam commented 12 years ago

Added in 0d7cf4ae47f31cb7f1918b8d25a54151c80081f2.