Upgrade to Pro — share decks privately, control downloads, hide ads and more …

do-not-delete-softly

 do-not-delete-softly

MOROHASHI Kyosuke

August 31, 2015
Tweet

More Decks by MOROHASHI Kyosuke

Other Decks in Programming

Transcript

  1. class Product < AR::Base scope :sellable, -> { where.not(status: :絶版)

    } end class ProductsController < AppC def index @products = Product.sellable.order(nantoka) end end class Backroom::ProductsController < AppC def index @products = Product.order(kantoka) end end
  2. class Order < AR::Base default_scope -> { where(deleted_at: nil }

    end # 忘れた頃に def clean_old_orders(orders) orders.unscoped.destroy_all # さらに忘れた頃に clean_old_orders(Order.where(company_id: 42))
  3. ຊ౰ʹ”࡟আ”ͳͷ͔? ‣b: ͦͷ··࢒͢ ‣ ୀձձһΛ status = :ログイ ン不可 ʹ͢Δ


    (status͸ͦΕ͸ͦΕͰ pros/cons ͋Δ΋ͷͷ…) ‣ೝূ৘ใ͚ͩফ͢