This snippet lets you generate secure, one-time-use tokens for password resets without Devise. It stores the token in the database, checks its validity, and clears it after use. The send_reset_link action sends the reset link, and the reset action ver
This snippet uses PostgreSQL’s JSONB column to store flexible metadata for orders, making it easy to store dynamic attributes without schema changes. The scopes allow efficient filtering using native SQL JSON functions. The update_metadata method enab
This snippet encourages larger cart values by dynamically showing how much more is needed for free shipping. The logic lives in free-shipping-bar.liquid, and it's rendered inside cart.liquid.
This setup separates the product badge logic into its own snippet product-badge.liquid, making it reusable across different sections like product listings and featured collections. The product-card.liquid section renders the badge alongside the produc
This snippet ensures every article gets a unique, readable slug based on its title, keeping it short and pronounceable. It grabs the first two words of the title and appends a 4-character random string to prevent duplicates. The before_validation call
This snippet stores user IPs efficiently using the PostgreSQL inet type, which optimizes space and lookup speed. The from_same_network scope allows querying users within the same /24 subnet, useful for analytics or security checks. The update_ip metho