Skip to content

Instantly share code, notes, and snippets.

@ivanacostarubio
Created April 28, 2011 02:32
Show Gist options
  • Select an option

  • Save ivanacostarubio/945679 to your computer and use it in GitHub Desktop.

Select an option

Save ivanacostarubio/945679 to your computer and use it in GitHub Desktop.
a piece on Ruby history
# FREEDOM PATCHING
# because monkeys have right
# http://vimeo.com/17420638
class Object
def has_attached_file(attribute, options={})
puts attribute
# WE CAN DO FANCY STUFF HERE
end
end
# OBJECT IS A TOP LEVEL CLASS SO WE CAN CALL IT FROM HERE
has_attached_file("On" + self.class.to_s)
class Tickets # THIS CAN INHERIT FROM EVERYTHING. THAT INCLUDES ACTIVE RECORD
# OR WE CAN CALL IT FROM HERE
has_attached_file("On " + self.class.to_s)
end
Tickets.new
class User
def initialize
# WE CAN LEVERAGE THE INITIALIZE METHOD
has_attached_File("On " + self.class.to_s)
end
end
Ticket.new
# RELIGION WARS HAVE BEEN FOUGHT FOR THE CONCEPTS EXPRESSED HERE
# AVOID WHEN POSIBLE / USE AT YOUR OWN RISK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment