public
Created

  • Download Gist
cow.rb
Ruby
1 2 3 4 5
class Cow < ActiveRecord::Base
def milk
milk_with MilkingMachine.next_available
end
end
kine_controller.rb
Ruby
1 2 3 4 5 6 7 8 9 10
class KineController < ApplicationController
def milk
cow = Cow.find params[:id]
if cow.milk
render :status => 200, :text => "milked"
else
render :status => 401, :text => "unable to milk"
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.