Step 3 / Select topic Rails Medium

What this bank covers

  • first on an empty relation
  • pluck returns a flat array
  • where with a nil value
  • group(...).count returns a hash
  • combining conditions with or
  • where.not and NULL values
  • order, limit and offset together
  • find_by! versus find_by
  • sum and maximum on an empty relation
  • joins produces one row per match
  • has_many dependent: :destroy
  • belongs_to optional: false
  • Association size vs count
  • has_many :through
  • Appending with << on a has_many
  • has_one foreign key location
  • dependent: :nullify
  • Autosaving built children
  • joins duplicates and distinct
  • habtm join table naming
  • Create callback order
  • full_messages wording
  • throw :abort in before_create
  • Normalizing in before_validation
  • Validation contexts with on: :update
  • Failed update leaves the row untouched
  • Callback firing order on create
  • Skipping validations with save(validate: false)
  • Halting the save chain with throw :abort
  • Full messages from a length validation
  • Counting columns created by create_table
  • Reading a NOT NULL constraint from the schema
  • The type behind a references column
  • rename_column replaces the old column
  • Custom primary key names
  • Schema defaults appear on new objects
  • Column defaults from add_column
  • Polymorphic references add two columns
  • remove_column and the resulting column list
  • Query string values are strings
  • Nested parameters
  • Path parameters win over query parameters
  • permit filters unlisted keys
  • before_action with :only
  • Strong parameters protect columns
  • Inflector pluralization rules
  • underscore on namespaced constants
  • Hash#deep_merge
  • Date#advance across month ends
  • String#squish
  • String#titleize
  • ActiveSupport::Duration inspect
  • String#parameterize
  • blank? and zero
  • Array#in_groups_of
  • Exponential backoff total wait
  • Idempotency guard against duplicate delivery
  • Priority ordering with FIFO tie-break
  • Retries stop at the first success
  • GlobalID arguments reload at perform time
  • Exhausted retries land in the dead set
  • Scheduled delay plus retry backoff
  • Makespan of a greedy two-worker pool
  • Enqueue after commit, not after create
  • Unique jobs collapse repeated lock keys
  • String interpolation opens a SQL injection hole
  • Constant-time comparison helpers differ on length
  • MessageVerifier detects tampering
  • Decrypting with the wrong key
  • Escaping LIKE wildcards
  • Quoting values with sanitize_sql
  • HTML escaping guards against XSS
  • Mass assignment is unguarded at the model layer
  • SecureRandom.hex counts bytes, not characters
  • Expired signed messages fail verification
  • includes preloads the association
  • strict_loading blocks lazy association loads
  • counter_cache keeps a denormalised count
  • find_in_batches chunks a large table
  • select narrows the attributes loaded
  • any? uses an existence query
  • eager_load joins in one query
  • update_all bypasses validations and callbacks
  • SQL aggregates on an empty relation
  • insert_all batches rows into one statement
  • Default index naming in migrations
  • Route order inside resources
  • Resourceful edit route
  • Dynamic segments become params
  • Dots and the format segment
  • The seven resourceful actions
  • Naming of resourceful path helpers
  • PATCH and PUT both reach update
  • Nested resource member paths
  • Singular resource routes
  • Route globbing with a wildcard segment
  • require + permit with an array filter
  • permit! marks nested parameters permitted
  • [] access versus require
  • Scalar filters reject array values