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.
How to organize methods in a Ruby class
Quick answer: class should tell a story.
Rails 5 makes sql statements even more colorful
Sql statements are more colorful in Rails 5. [more inside]
Lesbians Who Tech sponsors $100k coding bootcamp scholarship
http://lesbianswhotech.org/codingscholarship/ LGBT women can apply to attend Thinkful, Mother Coders, or Dev Bootcamp. The scholarship will defray the cost of tuition by at least 50%.
Effectively Scaling Sidekiq Workers
A case study on organizing Sidekiq queues, workers, and throttles for stability and higher concurrent throughput. Going from constant errors and downtime to 300k jobs a day http://sorentwo.com/2016/06/28/effectively-scaling-sidekiq-workers.html
Logidze: a fast versioning and diffing library for ActiveRecord and latest PostgreSQL
Logidze is a faster tool by and large and second to none when it comes to calculating diffs for ActiveRecord models. [more inside]
If dynamic types are no good (and they are not), why are they so popular?
http://blog.debugme.eu/dynamic-typing/ An argument for dynamic typing is that by not enforcing the types of a function’s parameters, the function becomes more generalized, and thus more flexible and reusable. I argue that this flexibility versus automatically-verifiable correctness of the system is not a trade-off we need to make.
JSONB + Rails to store glorified strings in your DB
Everyone likes a good hack sometimes, like storing a list of values as one comma-separated string in DB. Let’s see how to use Postgres JSONB for a nicer implementation.
[Guide] Hybrid-native Tab Bar app with Turbolinks 5
Getting into hybrid-native apps? As excited about Turbolinks Android and Turbolinks iOS as we are? Want to go beyond “the README”? The guide to create a tab bar app with turbolinks-ios and Rails 5.
How to cook Rails Controllers
Please, stop access directly instance variables. Stop using a lot of callbacks and creating fat Rails controllers. How to make your controllers better.
[Screencast] Importing and Exporting CSV Data
Basics on importing and exporting CSV Data using Ruby and without gems. https://www.driftingruby.com/episodes/importing-and-exporting-csv-data
How does multiparameter attributes work in Rails
An overview of how multiparameter attributes work in Rails and how you can use them to your advantage. Read more here
Sprinkle some HATEOAS on your Rails APIs
What are the four levels of REST? What is content negotiation and hypermedia controls? And how can we implement or use all these in Rails? Read more here.
Rails 5 adds helpers method in controllers to ease usage of helper modules
Controllers can access helper methods in Rails 5. More Details
Essential & Useful Ruby Gems for Rails 4
Ruby gems makes development much easier. They are packaging systems designed to facilitate the creation and distribution of Ruby programs and libraries. Check out some of the best Ruby on Rails gems for Rails 4.
Observers in Rails
Let’s say you need to listen to changes in a model’s attributes and trigger some events based on those changes. If you look at the following example, I’ve done exactly that. If the status of the application is changed an email is sent. [more inside]
IMPLEMENTING UPSERT IN RAILS
An upsert is update or insert. Upsert in database terms refers to an operation which should insert a row into a database table if it doesn’t not already exist, or update it if it does. One can implement this function in Rails by writing anActiveRecordExtension. This will allow you to call the upsert method on any model. [more inside]
Journeta Engine updated for Ruby 2.3.1!
Journeta is the simplest, most flexible gem for finding Ruby processes on the local network, allowing event-based exchange of arbitrary data with ZERO configuration. Peer management is managed automatically by the engine. Today’s v1.1.0 release comes after a two-year hiatus, and adds first-class support for v2.3.x of the default Ruby interpreter (MRI) in addition to bug fixes and sample code. Journey is free software from Lee Does.
New tty-progressbar fixes rate measurements.
tty-progressbar v0.10.0 fixes rate measurements for :rate, :mean_rate, :byte_rate and :mean_byte formatting tokens.
Why is a BasicObject a Range?
Recently I came across a Ruby bug that manifested itself in some interesting behavior around BasicObject and Range; enjoy the debugging notes!
NPM integration for Rails
https://github.com/endenwer/npm-rails This gem made it easy to bring NPM to Rails. Under hood it use Browserify. Just like Bundler but for NPM packages.
RAILS I18N AND ELEGANT MESSAGE PASSING TO JAVASCRIPT
Internationalization is the process of abstracting all strings out of your application. Rails provides excellent support for Internationalization. [more inside]
A sample Ruby script to achieve fast incremental back-up on btrfs partition
In this article I describe a simple strategy to achieve incremental back-ups quickly and explain a sample Ruby script that implements it.
Clear Intentions: Do you speak 3?
It’s easy to mistake current knowledge for universal knowledge. Decisions that were straightforward a year ago are a mystery today. We’ve all done it. Why did I pick that value? What made them do it that way? One way to mitigate this is to make your code clarify your intent. [more inside]