Skip to content
  • Petrik's avatar
    33114544
    Avoid `orders_count` in Active Record `order` guide examples · 33114544
    Petrik authored
    
    
    The ordering examples use `Customer#orders_count` for ordering which
    results in beginner-unfriendly examples like:
    
      Customer.order(:orders_count)
    
    Having two unrelated types of `order` can be confusing.
    As Customer has many Orders it's probably better to replace the Customer
    with Book to avoid any confusion.
    
    Not having `orders_count` also makes it easier to grep for 'order' in
    the guide. This also is a reason the `Order.none` example is replaced
    with `Book.none`, besides it being more consistent with the example
    below it.
    
    Co-authored-by: default avatarRyuta Kamizono <kamipo@gmail.com>
    33114544
    Avoid `orders_count` in Active Record `order` guide examples
    Petrik authored
    
    
    The ordering examples use `Customer#orders_count` for ordering which
    results in beginner-unfriendly examples like:
    
      Customer.order(:orders_count)
    
    Having two unrelated types of `order` can be confusing.
    As Customer has many Orders it's probably better to replace the Customer
    with Book to avoid any confusion.
    
    Not having `orders_count` also makes it easier to grep for 'order' in
    the guide. This also is a reason the `Order.none` example is replaced
    with `Book.none`, besides it being more consistent with the example
    below it.
    
    Co-authored-by: default avatarRyuta Kamizono <kamipo@gmail.com>
Loading