Skip to content

Instantly share code, notes, and snippets.

@wycats
Created June 3, 2011 20:54
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 wycats/1007150 to your computer and use it in GitHub Desktop.
Save wycats/1007150 to your computer and use it in GitHub Desktop.
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