A ledger is the board or framing member that secures a deck or porch to the building. Deck and porch ledgers should be securely bolted to the building to prevent injuries from failure. If nails are the only method used to secure the ledger, then contractor or engineer review and REPAIR is recommended for safety.
California codes state: Where supported by attachment to an exterior wall, decks shall be positively anchored to the primary structure and designed for both vertical and lateral loads. Such attachment shall not be accomplished by the use of toenails or nails subject to withdrawal. Where positive connection to the primary building structure cannot be verified during inspection, decks shall be self-supporting.
A fairly straightforward guide to deck construction is provided by the Simpson Strong Tie company.
A diagram showing some typical deck ledger attachment methods: