Skip to content

Instantly share code, notes, and snippets.

@we4tech
Created July 24, 2012 06:13
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 we4tech/3168329 to your computer and use it in GitHub Desktop.
Save we4tech/3168329 to your computer and use it in GitHub Desktop.
Sample active record model
class Page < ActiveRecord::Base
attr_accessible :body, :metadata, :title, :store_id
# Relationships
belongs_to :store
# Validations
validates_presence_of :title, :body, :store_id
# Scopes
scope :recent, order('created_at DESC')
# Utilities
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment