Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class Post < ActiveRecord::Base
# has_many is inherited from AR::Base
has_many :comments
end
class PostsController < ActiveController::Base
# before_filter is inherited from ActionController::Base
before_filter :authenticate
def authenticate
raise Unauthenticated unless user.logged_in?
end
end
# this allows frameworks/libraries to build features that appear built-in
class Person
# attr_accessor is defines getters/setters, but is actually inherited from Class
attr_accessor :name, :address
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.