Create a gist now

Instantly share code, notes, and snippets.

@bryanl /cow.rb
Created Aug 18, 2011

class Cow < ActiveRecord::Base
def milk
milk_with MilkingMachine.next_available
end
end
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment