Model - persistent data business logic CART USER LINE_ITEM PRODUCT.

  • RELATIONSHPS BETWEEN THE MODEL OBJs
  • has_many or belongs_to like line_items belong to a cart and a cart has_many products/line_items 
  • models have attributes 
  • data validations
VIEW
  • presenting yourself, default edit, new, form, index, show
  • helpers for view behavior keeping views slim
  • ATOM
CONTROLLER
  • Find and fetch data 
  • put data in instance vars
  • callback actions
  • CONCERN - common controller logic
  • GET - new, index, show, edit
  • POST - create
  • PUT - update
  • DELETE - destroy
ACTIVE RECORD: maps 
  • CRUD
  • many_to_many - has_and_belongs_to
  • one_to_many
  • one_to_one
  • scope :last_n_days, lambda {|days| where('updated < ?', days)}   
    • then you call it with orders = Order.last_n_days(7)
  • create, create!, save, save!   
    • ! always sends back an exception
    • in create vs create! you may not know if it truly was written unless use !
    • Defining your data, locating and traversing records, CRUD (create, read, update, and delete), Participating in the monitoring process, transactions
    • Transaction- ALL or nothing
ACTION DISPATCH
  • Dispatching requests to controllers
ACTION CONTROLLER

TESTS
  • The most stable ting about any object is its public interface; tests should be for messages that are defined in public interfaces
  • Assertions about values that messages RETURN (STATE)  incccccoming
  • Messages PROPERLY sent



Comments

Popular posts from this blog

ADVERTISING STYLES