The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Monobank API Ruby
Unofficial Ruby Gem for Monobank API - https://github.com/vergilet/monobank
Testing signed and encrypted cookies in Rails
Signed and encrypted cookies are really easy to use in Rails, but less clear is how to test them. Some test classes make it easy, others do not. So how do we test signed and encrypted cookies in Rails?
How to solve flaky Rails specs
continuing the recent discussions in the community about flaky Ruby tests, I introduce a project that shows flaky rspecs and example solutions. This can be used to practice fixing real-world flaky Rails test suites.
Pros and Cons of Using structure.sql in Your Ruby on Rails Application
Discover the major differences and benefits of using structure.sql vs schema.rb in your Ruby on Rails application. [more inside]
3 ways Webpack surprises Rails developers
I spent the past month answering Webpack and Webpacker questions on StackOverflow and came away with some thought about what trips up developers most. https://rossta.net/blog/three-ways-webpack-surprises-rails-developers.html
Cache Crispies - Fast, Flexible Rails Serializer
Picking a method of doing JSON serialization in Rails has not been an easy decision as of late. Especially if you’re not able to break your APIs by moving to a JSON API structure. And trying to mix in a caching strategy, certainly doesn’t help. That’s the problem the new Cache Crispies gem was written to fix. [more inside]
The top Ruby Weekly links of 2019
https://superhighway.dev/ruby-2019 - A look back at what proved popular with Rubyists last year.
How to create a complex testing context in a few seconds ?
https://github.com/morissetcl/like_im_five A simple gem that generate a file with factories you need to test a specific object. It use you DB development to retrieve the object you want and all associations you need to setup the test.
Development must be fun
https://github.com/igorkasyanchuk/sabotage would like to add this to your project?
Rails, Routes, & Flags
In case it went under your radar. You can now use flags for rails routes. [more inside]
Duplicating models with complex nested associations
For one of our current project, we needed to duplicate model records as well as their children and recursive associations. That’s a fun thing to do … so we wrote what we found here
What's new in Ruby 2.7
Ruby 2.7 has introduced a few new features, like new syntax for pattern matching, startless ranges and numbered parameters, while some others like the pipeline operator and the method reference operator didn’t make the cut. Here’s a quick summary: [more inside]
Dependency Injection in Ruby
A handy pattern for writing code called Dependency Injection can make your code more flexible and more testable. It doesn’t take much, but it can make a huge difference. Learn how to use Dependency Injection in Ruby
All blogs about Ruby in one place.
A curated list of Awesome Ruby Blogs and Newsletters for Ruby Developers and Newbies https://github.com/Yegorov/awesome-ruby-blogs
fstrings: Powerful formatting strings
Python-alike fstrings allow to use interpolation + formatting tags + custom objects formatting: f"Pi value is {Math::PI = %.3f}, today is {Time.now %Y-%m-%d}" => "Pi value is Math::PI = 3.142, today is 2020-01-08"
Building The Best Magic Link
I wrote this article on what you should consider if you are going to be implementing a magic link sign in for your application. [more inside]
Ruby Reference updated for Ruby 2.7
Ruby Reference is intended to be most full, actual and accessible language reference. Most of the reference content is taken directly from Ruby documentation and reorganized for easier reading. The core docs were augmented with some quotes from the Ruby website, and some missing content that is written specifically for the book. The source of the book (rendering scripts, config, and unique content) can be found at GitHub. Today I am releasing the new version, which was fully re-rendered for Ruby 2.7 and also includes some content and style fixes. Changelog.