Created
June 3, 2011 20:54
-
-
Save wycats/1007150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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