Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.23 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Rails: what are the main reasons for making methods private?
  2. private
  3.   def current_cart Cart.find(session[:cart_id])
  4.    rescue ActiveRecord::RecordNotFound
  5.    cart = Cart.create
  6.    session[:cart_id] = cart.id
  7.    cart
  8.    end
  9. end