event-sourcing
event-sourcing
ruby
How to add rate limiting in Ruby on Rails 8
Rate limiting in Rails 8 is built in: the rate_limit method declares limits per controller and action, like 3 requests per 2 seconds on create. How to combine short and long windows, protect unsafe actions, and practical suggestions for sensible limits.
ruby
How to send files from Javascript/React to a Ruby on Rails API Controller
Sending files from JavaScript or React to a Rails API: build a FormData object with the file and extra params, POST it with fetch, then read params[:file] in your controller. A minimal frontend plus backend walkthrough that works.
Latest
Powerful switch statement with pattern matching in Ruby
Pattern matching in Ruby turns case statements into a precise switch over data shapes: match and destructure hashes from an API response, combine several patterns in one branch, capture values across patterns, and validate configuration. Ruby 2.7+ syntax examples.
How to set up XML in Grape API
XML support in Grape API takes two steps: register the additional content_type so endpoints accept and return application/xml, then change the root element name of the XML output. Complete Ruby examples built around a products endpoint you can adapt to your API.