fork download
  1. class Post < ActiveRecord::Base
  2. belongs_to :user
  3. default_scope -> { order('created_at DESC') }
  4. validates :user_id, presence: true
  5. validates :body, presence: true
  6. validates :title, presence: true, length: { maximum: 200 }
  7. end
  8.  
Runtime error #stdin #stdout #stderr 0.01s 7452KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.rb:1:in `<main>': uninitialized constant ActiveRecord (NameError)