Skip to content

Instantly share code, notes, and snippets.

@josevalim
Created February 9, 2009 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josevalim/60923 to your computer and use it in GitHub Desktop.
Save josevalim/60923 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'active_support'
class Father
cattr_accessor :name
end
class Son < Father
end
class Daughter < Father
end
Father.name = 'Martin'
Son.name = 'Paul'
Daughter.name = 'Laura'
puts Father.name #=> Laura
puts Son.name #=> Laura
puts Daughter.name #=> Laura
require 'rubygems'
require 'active_support'
class Father
class_inheritable_accessor :name
end
class Son < Father
end
class Daughter < Father
end
Father.name = 'Martin'
Son.name = 'Paul'
Daughter.name = 'Laura'
puts Father.name #=> Martin
puts Son.name #=> Paul
puts Daughter.name #=> Laura
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment