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
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Hello, Inspired by Let’s Build the Tiniest Blockchain
In Less Than 50 Lines of Python I’ve put together a Ruby version. Blockchains, blockchains, blockchains! See the blockchain.rb sample in the Awesome Blockchains repo. Use
$ ruby ./blockscript.rb to run. Happy blockchaining. Cheers.
Where should we place validations? In the model or in the form object? We answer this question in the third and final article of the series on Form Objects.
An article shows 2 solutions how Rails model’s unique validations should be implemented to save performance https://medium.com/@igorkhomenko/rails-make-sure-you-have-proper-db-indexes-for-your-models-unique-validations-ffd0364df26f
I’ve compiled a list of techniques learned while writing feature tests in Capybara. Read the full article here.
I use these modules in most of my projects to have useful scopes based on columns’ types (dates, times, strings and numerics). I finally took the time to extract it into a fully reusable gem :) https://github.com/BaseSecrete/type_scopes
Folks, a few weeks ago I dockerized and deployed my rails application to AWS. I hope that it be useful to someone. [more inside]
DidYouMean, bundled with recent Ruby versions, does pretty error messages with suggestions, like
undefined method 'cover' for 1..10:Range. Did you mean? cover?. If you want to implement the same functionality for your own entities (some tags, lexemes or metaprogrammed things), you will probably find this small wrapper gem useful.
Most of the time, with growing uncertainty, code goes rightwards. Nested conditions are difficult to read and error prone. The real intent is to check success/failure path, so why not make it clear?
tl;dr: Two-thirds of the top OSS projects are maintained by one or two people. This is not sustainable. We can help. [more inside]
Learn to use single table inheritance to allow multiple classes to be stored in the same database table. https://www.driftingruby.com/episodes/single-table-inheritance
Ruby is a programming language while Rails is the web application framework that implements it. Developed by Yukihiro Matsumoto, Ruby on Rails has found utility in some of the coolest and widely known projects worldwide. Here are few that catch the limelight. 7 Successful Stories From Ruby On Rails Web Development
Once upon a time, there was a super fun to write programming language called Ruby…