Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Ruby News 

Support of Ruby 2.2 has ended

We announce that all support of the Ruby 2.2 series has ended.

After the release of Ruby 2.2.7 on March 28, 2017, the support of the Ruby 2.2 series was in the security maintenance phase. Now, after one year has passed, this phase has ended. Therefore, on March 31, 2018, all support of the Ruby 2.2 series has ended. Bug and security fixes from more recent Ruby versions will no longer be backported to 2.2, and no further patch release of 2.2 will be released. We highly recommend that you upgrade to Ruby 2.5 or 2.4 as soon as possible.

About currently supported Ruby versions

(as of Jun 20th, 2018)

Ruby 2.5 series

Currently in normal maintenance phase. We will backport bug fixes and…

The Bike Shed 

159: Confusing and Hard to Use

An ORM that's a pleasure to use with raw SQL when needed? Sean discusses how that can be. Plus, Derek shares a new and exciting way for migrations to break!

Rebased Blog 

Rebased featured as one of the leading Eastern Europe B2B companies on Clutch

We’re proud to announce that Rebased is featured in a press release highlighting leading Eastern Europe B2B companies on Clutch! While the competition is fierce and Poland’s well known for many excellent developers and software houses, Rebased boasts both high Clutch rank and review score. Top B2B Service Providers in...
RubyMine Blog 

More YAML improvements in the Updated RubyMine 2018.2 EAP

Hi there,

RubyMine 2018.2 EAP (build 182.3341.19) has just been updated. The new build provides more YAML improvements.

Download RubyMine 2018.2 EAP

Smarter YAML with JSON Schemas

Starting with this EAP RubyMine provides code autocompletion and inspections for YAML data structures that have a JSON Schema file.

The IDE automatically traces schemas from schemastore.org (Preferences | Languages & Frameworks | Schemas and DTDs | Remote JSON Schemas). For instance, Travis CI has a JSON schema file posted there. So if you use Travis to test and deploy your apps, you can now edit configurations in your .travis.yml file faster:

You…

Awesome Ruby Newsletter 

Issue 110 - Demand for Rails is still huge

Ruby Weekly 

Pair programming with Ruby creator Matz

#404 — June 21, 2018

Read on the Web

Ruby Weekly

▶  Pair Programming with Matz at RubyKaigi — Watch along as Matz (creator of Ruby) and Jonan Scheffler (Heroku) code Conway’s Game of Life in real time.

Jonan Scheffler

You Can Now Install TruffleRuby via RVM (and ruby-build) — They also added it to ruby-build so rbenv users can get in on the fun with this high performance GraalVM-based Ruby implementation.

RVM

Plan Visually with a Single Glance and Make Sure Your Projects Get Done — monday.com is a project management tool your team will enjoy using. It makes it fun and easy for everyone to…

Hi, we're Arkency 

Removing magic with magic

Some gems, like InheritedResources, help us by reducing the lines of code we have to write by providing definitions automatically. However, depending on how the gem is written, it can be done “magically”. In some cases, we want to remove such gems.

By “magic” I obviously mean defining methods, or in this case, controller actions, without any explicit call to the functions provided by this gem. Such implicit behaviour makes life on legacy codebases harder. It’s harder to remove the feature (or model), because how do we know whether it is used or not? Similarly, it is harder to add feature correctly, because it’s easy to overlook some dependency or usecase which is available in our…

All Ruby Podcasts by Devchat.tv 

MRS 049: Amit Choudhary

Panel: Charles Max Wood

Guest: Amit Choudhary

This week on My Ruby Story, Charles talks to Amit Choudhary. Amit was previously on Ruby Rogues in January 2018 on episode 345 discussing app failures. Amit is a software developer at Big Binary, where he is a full-stack Ruby developer. He first got into programming when he learned C for a computer engineering course. They talk about how he got into Ruby, what he has done with Ruby, what the Ruby community is like in India, and what he is working on now.

In particular, we dive pretty deep on:

Ruby – Sihui Huang 

First Impression of Elixir, from a Rubyist’s Perspective

If you’re a Rubyist, you might have heard of Elixir: the new functional language with Ruby-like syntax created by José Valim, who used to be on the Rails core team. If you’re curious about it and wondering if you should give it a try, this post is for you!

After playing with Elixir for about a month, I decided to write a post summarizing my thoughts. This post covers the following:

  1. Why I didn’t try Elixir earlier;
  2. Nitpicking at object-oriented programming and Rails;
  3. What changed my mind and made me give Elixir a try;
  4. Materials I used to learn Elixir;
  5. My thoughts after a month.

Why I didn’t try Elixir earlier

Elixir has made a lot of noise in the Ruby community. I heard it being praised…

Running with Ruby 

RubyKaigi 2018 Review – conference in a nutshell

RubyKaigi 2018 has ended, but the excitement is still fresh. After 25 hours in planes, trains, buses, and cabs we’re finally home. I guess it’s a good time to summarize and review 4 days on the best Ruby conference in the world.

Castle.io support

First of all, I would like to express special thanks to Castle.io for backing me up, providing me possibility to go to RubyKaigi and for their ongoing Karafka support. Wouldn’t happen without them.

What is RubyKaigi?

RubyKaigi about itself:

RubyKaigi is the authoritative international conference on the Ruby programming language, attracting Ruby committers and Ruby programmers from around the world to Japan, the birthplace of Ruby. Held nearly…

Semaphore Engineering Blog 

Rails Testing Handbook Available for Kindle

Rails Testing Handbook

In April, we officially released Rails Testing Handbook, a free ebook in which our engineers shared how to write tests and practice BDD to develop sustainable Rails applications. The handbook teaches you all you need to know about the BDD approach of analyzing, testing, coding, and designing a system in one short feedback loop. BDD helps us produce better software, while also avoiding mistakes and wasteful work.

You can now also download Rails Testing Handbook for Kindle.

Why we wrote the Rails Testing Handbook

Writing code driven by tests is pretty much how we built and grew Semaphore, our CI/CD product. All that time, we’ve been doing BDD, and it has helped us write…

Greater Than Code 

085: BOOK CLUB! Technically Wrong

For our second Book Club episode, Sara Wachter-Boettcher joins us to talk about her book, Technically Wrong: Sexist Apps, Biased Algorithms, and Other Threats of Toxic Tech.

We have interactive show transcripts! Powered by Gretta.


Panelists:

Jamey Hampton | Astrid Countee | John K. Sawers

Guest Starring:

Sara Wachter-Boettcher: sarawb.com, Co-host of the No, You Go show

Buy the book! Technically Wrong: Sexist Apps, Biased Algorithms, and Other Threats of Toxic Tech

Show Notes:

01:02 – Sara’s Superpower: Communication and Connecting the Dots

03:43 – The Process of Writing, Editing, and Communicating the Book

06:17 – A Summary of Technically Wrong

11:13 – The Harms and Risk of Data Sharing…

RubySec 

Path Traversal in Sprockets

OmbuLabs Blog 

Another successful Rails Girls event

Last month was the fifth edition of the Rails Girls Buenos Aires event, and the third time Ombu Labs participated as a sponsor and part of the coaching team. This time it took place in the impressive offices of Google Argentina where 25 participants attended. All of them were very excited and motivated to start learning new skills.

For those who have never heard of Rails Girls, it’s a 2-day workshop to introduce women to programming, with a focus on the Ruby on Rails framework. We also talk about the current situation of women in technology and the things that we can do to increase the number of women working in this industry.

During the workshop, each participant developed a basic…

All Ruby Podcasts by Devchat.tv 

RR 367: Ruby Core Language Evolution: Moving towards functional with Victor Shepelev

Panel:

  • Charles Max Wood
  • Dave Kimura
  • Eric Berry
  • Catherine Meyers
  • David Richards

Special Guests: Victor Shepelev

In this episode of Ruby Rogues, the panelists talk to Victor Shepelev about functional programming in Ruby. Victor is a Ukrainian programmer and poet who has been programming since he was a child. He has been programming with Ruby for the past 12 years and has contributed a lot to the open source community, as well as mentors and participates in discussions about Ruby’s progress. They talk about how to approach functional programming in Ruby, changes Victor hopes to see in Ruby, and more!

In particular, we dive pretty deep on:

  • Victor intro
  • What is functional…
Julia Evans 

How I use Wireshark

Hello! I was using Wireshark to debug a networking problem today, and I realized I’ve never written a blog post about Wireshark! Wireshark is one of my very favourite networking tools, so let’s fix that :)

Wireshark is a really powerful and complicated tool, but in practice I only know how to do a very small number of things with it, and those things are really useful! So in this blog post, I’ll explain the 5 main things I use Wireshark for, and hopefully you’ll have a slightly clearer idea of why it’s useful.

what’s Wireshark?

Wireshark is a graphical network packet analysis tool.

On Mac, you can download & install it from their homepage, and on Debian-based distros you can install…

Dustin Zeisler 

Visualize Ruby with Flowcharts

See Ruby control flow and methods calls as flow charts. Helps developers better understand code and explain it to the non-technical. By using the DSL you already know, Ruby.

Play around with a live Ruby editor demo and see the flow chart being formed on the right.

Visualize Ruby Demo

Write a Ruby class and see method interactions. Visualize Ruby Demo Works with procedural code and bare methods. This is experimental project and does not support all types of code.

Under the hood this is using GraphViz and parser gem. Parser is used to transform the code to an AST and based on each type converts those to GraphViz nodes and edges to create the flow chart.

It’s open source, visualize_ruby. Feedback and pull-request are…

RubyMine Blog 

YAML Code Formatter, chruby, asdf, and More in the Updated RubyMine 2018.2 EAP

Hi everyone,

RubyMine 2018.2 EAP (build 182.3208.25) is now updated and adds some major improvements. Let’s review those.

Download RubyMine 2018.2 EAP

Asdf, chruby, and remote version managers

Support for Ruby version managers has been significantly reworked, which may result in some new issues (please report them if you face any). Nevertheless, the following major features have been added:

  • chruby support [RUBY-14086]
  • asdf support [RUBY-20370]
  • All version managers (RVM, rbenv, asdf, and chruby) are now available in WSL, and also through SSH and other remote connections (Preferences / Settings | Languages &…
Riding Rails 

Faster record deletion, customized error messages, bug fixes, and more!

Greetings, all! This is Daniel, with the latest news about Ruby on Rails.

This Week’s Contributors

14 people contributed to Rails this past week, including 4 first-time contributors. Many thanks to all!

Are you looking to get involved? Check out the list of open issues!

Faster dependent destroying

Has GDPR got you deleting users and all their “likes”? The dependent: destroy option has been updated to use a linear algorithm, rather than a quadratic one. I like that!

Allow suffixing store attributes

Back in March we added the option to use prefixes for your store attributes. Well now you can use suffixes as well. Say goodbye to clashing method names!

Flexible error message…

The Bike Shed 

158: This is How I Ruin Meetings (Aaron Patterson)

We're joined by Aaron Patterson for puns. Aaron also updates us on compacting GC for Ruby and Ruby 2.6's JIT compiler before telling us how he really feels about functional programming.

Awesome Ruby Newsletter 

Issue 109 - Asynchronous Ruby

The Life of a Radar 

Making Tests Go Faster

At Culture Amp, we have a large Rails app that we’ve been building since 2011. This app has about 150k LOC and an extensive test suite that uses Rubocop, RSpec, Capybara, Cucumber and FactoryBot.

We run these tests for the application on Buildkite and currently they take about 16 minutes to run end-to-end. This is 16 minutes that developers are waiting to get feedback on whether their build passed or failed. While this is not unacceptably high, we could do better. Developers could ship things faster, or respond quicker to build failures, with faster builds.

A large chunk of that build time is spent running these tests. In fact, we currently have 8 machines running tests concurrently for…

EquiValent 

Rails CSRF protection for SPA

Topic of SPA (Single Page Applications like React) and Ruby on Rails as an API only is around for a while. This Frontend & Backend split inspired lot of other technology approaches like JWT (JSON Web Tokens)

But there is quite lot of confusion around security. One of the biggest topics is CSRF (Cross Site Request Forgery).

I’ve already wrote an article on the topic before why it is needed in SPA that uses sessions ( CSRF protection on single page app API ) but really didn’t provide any “how to” guide.

Let’s fix this in this article. All the methods mentioned here are equally valid it just really depends on the usecase your application needs.

Special thanks goes to johnunclesam

Ruby Weekly 

Improving Ruby Concurrency

#403 — June 14, 2018

Read on the Web

Ruby Weekly

Ruby's External Malloc Problem — Discourse’s Sam Saffron explores a “severe, extremely hard to debug vector for memory bloat in Ruby which can be triggered by the PG (Postgres) gem”.

Sam Saffron

Improving Ruby Concurrency — Using Fibers and non-blocking operations, it’s possible to dramatically increase concurrency in Ruby without the overhead of multi-threaded programming.

Samuel Williams

Productivity Meets Beauty—Learn Ruby Free for 10 Days — You can learn a lot in 10 days. Start a trial and get unlimited access to expert-led dev courses and more.

RubyGuides 

Why Do We Create Classes?

Following my last article, why do we use nil, I thought it’d be a good idea to ask this question for other things that we take for granted. Like… Why do we use classes instead of having just one GIGANT blob of ugly code? At a fundamental level, we use classes to organize code & […]

The post Why Do We Create Classes? appeared first on RubyGuides. Don't miss your free gift here :)

All Ruby Podcasts by Devchat.tv 

MRS 048: James Shore

Panel: Charles Max Wood

Guest: James Shore

This week on My Ruby Story, Charles talks to James Shore about his background, how he got into programming, pitfalls that happened along the way, and his Agile story. James Shore is a thought leader in the Agile software development community. He was an early adopter of Agile development and he continues to lead, teach, write, and consult on Agile development processes.

In particular, we dive pretty deep on:

  • James Shore’s background:
  • How did you get into programming?
    • Began an interest at 15 years old.
  • How did you go from hobbyist to a professional?
    • Modem…
Greater Than Code 

084: Federation Is Bad with Aurynn Shaw

After a particularly compelling conversation after Auyrnn Shaw’s last episode, we invited her back on the show to talk about why federation is problematic in Internet society.

We have interactive show transcripts! Powered by Gretta.


Panelists:

Coraline Ada Ehmke | John K. Sawers

Guest Starring:

Aurynn Shaw: @aurynn | blog.aurynn.com | Eiara

Join Our Slack Channel!
Support us via Patreon!

Show Notes:

01:30 – Federation and Your Internet Identity

Mastodon

Stayin’ Alive in Technology: Who Are You?
Coraline Ada Ehmke and Identity on the Internet

05:59 – Flaws of Federated Identity

Usenet

10:18 – Onboarding

Eternal September

28:51 – All Technology is Political & Speech At All Costs

The…

Sam Saffron 

Ruby's external malloc problem

In this post I would like to cover a severe, extremely hard to debug vector for memory bloat in Ruby which can be triggered by the PG gem.


I have blogged a bit about the Ruby GC previously and covered some basics about malloc triggering GC runs. Over the years much in that blog post has been addressed in Ruby including dynamically growing malloc limits that mean we very rarely would need to amend malloc related GC vars.

As an aside, the only GC var Discourse still overrides is RUBY_GLOBAL_METHOD_CACHE_SIZE for reasons that are specified in the Shopify blog post by Scott Francis.

The GC in Ruby can be triggered by 2 different types of conditions.

  1. We are out of space in our managed heaps.

JetRockets 

Applications of Lambda in Ruby

Thoughts about lambda in Ruby.
All Ruby Podcasts by Devchat.tv 

RR 366: Build Your Own RSpec: A Gentle Metaprogramming Intro with Paweł Dąbrowski

Panel:

  • Charles Max Wood
  • Dave Kimura
  • Eric Berry
  • David Richards

Special Guests: Paweł Dąbrowski

In this episode of Ruby Rogues, the panelists talk to Paweł Dąbrowski about metaprogramming and DSLs. Paweł is a Ruby developer, is on the iRonin team, and runs a Ruby blog, which he started in January 2018. They talk about his blog, the importance of contributing to the community, and why he chose to create his own version of RSpec. They also touch on how hard it was to get into blog writing as a developer, the use of blog writing as a way to confirm your skills, and much more!

In particular, we dive pretty deep on:

Passenger - Phusion Blog 

Passenger 5.3.2: various security fixes

Passenger 5.3.2: various security fixes

Version 5.3.2 of the Passenger application server for Ruby, Node.js, Meteor and Python has been released. This release contains fixes for 4 CVEs and we urge you to upgrade.

[CVE-2018-12029] CHMOD race vulnerability

The Pulse Security team discovered a vulnerability in Passenger.

The file system access race condition allows for local privilege escalation and affects the Nginx module for Passenger versions 5.3.1, all the way back to 3.0.0 (the chown command entered the code in 2010).

The vulnerability was exploitable only when running a non-standard
passenger_instance_registry_dir, via a race condition where after a file was created, there was a window in which it could be replaced with a…

Martian Chronicles, Evil Martians’ team blog 

Stick with security: YubiKey, SSH, GnuPG, macOS

Author: Kirill Kuznetsov, Lead Operations Engineer

Learn how we use USB sticks from Yubico to handle authentication in all our projects and project-related tools. See how to go beyond their built-in U2F functionality and use them for SSH authentication from a Mac with YubiKey holding all PGP keys and emulating an OpenPGP (GnuPG) smart card. If some of those acronyms seem unfamiliar—read on for more background.

Evil Martians are growing. With more employees and more clients, there is a demand for stronger security. Our clients trust us with their source code and, even more importantly, with access to their production servers, and this trust cannot be broken. In a hostile environment of…

BigBinary Blog 

Our Thoughts on iOS 12

iOS 12 on iPhone 8 Red

Apple announced iOS 12 at WWDC 2018 a few days back. Being honest, it was a bit disappointing to see some of the most requested features not being there in iOS 12. Like users have been asking for Dark mode since before iOS 11, and the ability to set default apps. It’s more of an update focussed on performance improvements, usability, and compatibility. The fact that iOS 12 is also available for the iPhones Apple released 5 years back is a great effort from Apple to keep users happy. And unlike last couple of years, this time we decided to calm our curiosities and installed iOS 12 beta 1 on our devices right away after Apple released it for developers. This blog is based…

Everyday Rails 

Simple shortcuts to get more out of Bundler

Ruby's dependency manager, Bundler, includes lots of features to help make life as a developer a little easier. Here are a few of my favorites, and the shortcuts I've written to make them even simpler to use.
Andy Croll 

Use beginning and end of string in regular expressions

We often validate user input using regular expressions.

There are lots of regular expressions on the Internet. Every now and then we might ‘borrow’ one to save ourselves the life-sapping pain of creating one anew.

However, we should beware.

Instead of…

…using ^ and $ to enclose the regular expression.

# A regular expression matching a
# string of lowercase letters
/^[a-z]+$/

Use…

\A and \z.

# A regular expression matching a
# string of lowercase letters
/\A[a-z]+\z/

But why?

Being specific in this case will reduce potential security holes in your code.

The characters ^ and $ match the beginning and end of a line, not the beginning and end of an entire string.

If your…

Riding Rails 

Improvements, bug fixes and more!

Hello everyone! This is Greg, with the latest news about Ruby on Rails!

This Week’s Contributors

13 awesome people contributed to Rails this past week!
If you’d like to be included here, why not check out the list of open issues?

Raise exception when column is already defined

With this change, migrations will raise an exception when defining an already defined column.

Align Time.zone.at method signature with that of Time::at

ActiveSupport::TimeZone#at now accepts an optional second argument, containing (fractional) microseconds, just like Ruby’s Time::at does.

Avoid allocating column names where possible

When requesting columns names from database adapters, ActiveRecord:Result used…

rossta.net 

Deploying Vue with CircleCI 2.0

I recently upgraded my Connect Four Vue.js application to build on CircleCI 2.0 . In my previous post, I showed how I used continuous integration on CircleCI 1.0 to bundle Vue.js assets and upload them to an S3 bucket configured to serve the application as a static website. But now that config is only good for another few months: CircleCI is sunsetting 1.0. Here's how I upgraded.

The basic steps of the build are the same: once I push changes to GitHub, CircleCI will detect those changes and trigger a build. It will bundle the app using the vue-cli. The assets output from that step will then be uploaded to S3 using the s3deploy golang package only if the build is running against master.

Giles Bowkett 

A Problem With Side Projects

I see a lot of people on Twitter talking about how, when the tech industry requires side projects, it disadvantages people who don't have free time to devote to side projects, and that those people are typically poorer people, and/or people from under-represented minority groups. In other words, the emphasis on side projects reinforces pre-existing imbalances.

This is legit, but there are really only two ways to keep your skills current: training, or independent study. Which basically means supervised side projects, or unsupervised side projects.

You might be able to do some of this at work. I'm doing a semi-supervised side project at work right now, writing a transpiler we need, and one of…
Pat Shaughnessy 

From ActiveRecord to Diesel


Learning something new every day is exercise for your mind.
(source: Jeremy Bowcock via Wikimedia Commons)

As software developers we’re paid to be professional learners. People hire us (or should hire us) for what we are capable of learning, not for what we already know. To stay in shape and keep up with our peers we need to practice by learning something new every day. We need to get daily exercise for our minds.

For me the best way to do this is to make simple tasks harder. Many times each day I need to copy files, parse XML, generate JSON, or send an HTTP request. The boring daily chores of a modern knowledge worker. To make my life more interesting and to exercise my mind,…

Sinatra 

Sinatra 2.0.2 and 2.0.3 are out

We would like to inform you that we have released Sinatra v2.0.2 and v2.0.3.

Before we begin, I want to thank everyone who contributed, helped test pre-releases, and continues to use and support the project.

Security Fix CVE-2018-11627

Sinatra had a critical vulnerability since v2.0.0. The purpose of this release is to fix CVE-2018-11627.

The vulnerability is that XSS can be executed by using illegal parameters. The issue was reported by @JokerCatz. Thank you so much.

If you’re using Sinatra v2.0.x, please upgrade to v2.0.2 or later.’

Releases

This release includes the release of the following gems, and associated versions:

  • sinatra: v2.0.2, v2.0.3
  • sintra-contrib: v2.0.2, v2.0.3

What is the…

Bundler Blog 

May 2018 Bundler Update

Welcome to the May Bundler update!

Last month, Bundler saw some bug fixes, a new --skip-install flag for bundler add, and a new guide on writing Bundler plugins. (Thank you @jules2689 for producing this guide!)

Bundler gained 9 new commits, contributed by 3 authors. There were 66 additions and 48 deletions across 17 files.

Interested in contributing to Bundler? We always welcome contributions in the forms of triaging bugs, adding new features, writing docs, and engaging with the wider community. Visit the Bundler Contributor Guidelines on GitHub to get started. Don’t have time to contribute, but want to support our work? Sign up as a member of Ruby Together to help fund our work to keep…

Ruby – Dog Snog dot Blog 

Testing the multi-subdomain Rails app

Writing tests for a multi-tenant, multi-subdomain app turns out to be very tricky to figure out, e.g.: I saw that, and understood the frustration. Integration tests ("request specs" or "feature specs") are built on a stack of frequently changing libraries and shifting API's. And the recipe for subdomain-aware testing isn't documented in any particular tool's notes. … Continue reading Testing the multi-subdomain Rails app

The Bike Shed 

157: Whiz-Bangy Frontend Thing (Chris Toomey)

Chris Toomey joins Derek to talk about their shared experience in Elm and their excitement about GraphQL.

GoRails Screencasts 

How to Migrate from Heroku to Hatchbox.io

See how to migrate your Ruby apps from Heroku to Hatchbox.io
Awesome Ruby Newsletter 

Issue 108 - Stripe is building a Ruby typechecker

Search Results for “ruby” – via @codeship 

Mathematics with MathJS

Reading Time: 8 minutes

One of the language design decisions in JavaScript has followed in C’s footsteps by providing implicit type conversions based on what operators you give it. For example in JavaScript, you can add true + true to get 2. While it may be convenient in some cases, this has been a pain point for many developers trying to locate and remedy bugs in their programs and makes it more difficult for developers new to the language to get their desired result.

So to save yourself from the headache of potential unintended type coercion with mathematics, you can be explicit with using MathJS and better guarantee the results you want.

MathJS is a very robust mathematics library that…

Ruby Weekly 

Ruby 2.6 Preview 2 Released

#402 — June 7, 2018

Read on the Web

Ruby Weekly

Ruby 2.6 Preview 2 Released — Another step closer to Ruby 2.6 with this feature packed preview which includes a JIT compilation feature you can play with, the RubyVM::AST module for parsing Ruby code, the then alias for yield_self, infinite range syntax, new constant naming rules, the exception keyword arguments, and more.

Yui Naruse

Stripe is Building a Ruby Type Checker — It’s called Sorbet and Stripe presented it at RubyKaigi. It’s a serious project (9 month of work by 3 people) and there are plans to open source it eventually.

Kristian Freeman

S…

Passenger - Phusion Blog 

How to get familiar with a new Open Source project

How to get familiar with a new Open Source project

A few weeks ago at the ROSS conf Amsterdam hackathon I joked that Passenger is too big a beast to fit the format. Getting familiar with the Passenger project and its coding style would probably exceed the scope of the event. Also it's largely written in C++ (where ROSS stands for Ruby open source software).

However, we do get requests from people who want to contribute to Passenger long term - beyond the incidental patch. To get more into the workings of Passenger, what helped me (as a fairly new member to the team 👋) was the following:

RubyGems Blog 

May 2018 RubyGems Updates

Welcome to the RubyGems monthly update! As part of our efforts at Ruby Together, we publish a recap of the work that we’ve done the previous month. Read on to find out what updates were made to RubyGems and RubyGems.org in May.

RubyGems.org News

RubyGems.org saw 17 gem updates and performance improvements for the search page. In addition, we revised the site footer to better clarify how Ruby Central, Ruby Together, and Fastly work together on RubyGems.org.

This month, RubyGems.org gained 27 new commits, contributed by 7 authors. There were 218 additions and 215 deletions across 13 files.

RubyGems News

RubyGems saw several bug fixes, support for reproducible gem builds, a new command…

RubyGems Blog 

March 2018 RubyGems Updates

Welcome to the RubyGems monthly update! As part of our efforts at Ruby Together, we publish a recap of the work that we’ve done the previous month. Read on to find out what updates were made to RubyGems and RubyGems.org in May.

RubyGems.org News

RubyGems.org saw 17 gem updates and performance improvements for the search page. In addition, we revised the site footer to better clarify how Ruby Central, Ruby Together, and Fastly work together on RubyGems.org.

This month, RubyGems.org gained 27 new commits, contributed by 7 authors. There were 218 additions and 215 deletions across 13 files.

RubyGems News

RubyGems saw several bug fixes, support for reproducible gem builds, a new command…

Toxic Elephant 

Importing GTG tasks into Taskwarrior

I used to use Getting Things Gnome (GTG) to keep my TODO list. However, the project seems dead right in the middle of its Gtk+ 3.0 port, so I’ve been looking around for an alternative. After much consideration, I decided on Taskwarrior. I wanted to keep my old tasks and couldn’t find a nice way to export them from GTG, let alone import them into Taskwarrior. So in the end I decided to create my own exporter.

Getting Things Gnome keeps your tasks in some simple XML files in a known location. HappyMapper is ideal for this. I started out using its automatic mapping, but as my understanding of the GTG format deepened, I switched to explicit mapping of a Task’s attributes and elements.

On the…

All Ruby Podcasts by Devchat.tv 

MRS 047: David Hemmat

Panel: Charles Max Wood

Guest: David Hemmat

This week on My Ruby Story, Charles talks to David Hemmat about his educational background, career choices, and suggestions for developers. David is a web developer who works mainly with Ruby on Rails. In the past few years, David has done work for a number of clients including Condé Nast, Six Red Marbles, ShopKeep, and Couplewise. Currently, David is working on a number of personal and professional development projects.

In particular, we dive pretty deep on:

  • David’s background
    • How did you get into programming?
    • David’s first job was being a software developer in the Dominican Republic.
  • Consulting and referrals
Greater Than Code 

083: Programming As An Identity with Tim Chevalier

Tim Chevalier talks about the collision of values within the programming industry and the meaning and measurement of intelligence, using programming to satisfy emotional needs and form identity, and merit and identity as a zero-sum game.

We have interactive show transcripts! Powered by Gretta.


Panelists:

Jessica Kerr | Coraline Ada Ehmke | John K. Sawers

Guest Starring:

Tim Chevalier: @fatneckbeardguy | catamorphism.org

Join Our Slack Channel!
Support us via Patreon!

Show Notes:

01:10 – Tim’s Superpower: Keeping Himself From Laughing / Improv

04:19 – Tim’s Journey as a Programmer

09:12 – The Collision of Values Within the Programming Industry and The Meaning and Measurement of…

22…

example.com 

Interesting Problems: Mondrian

I had an interesting problem presented to me the other day that I found fascinating to work through and allowed me to use my graphics gem. The problem was easy enough to describe:

How would you make this?:

/img/mondrian_orig.jpg     This is just one of many pieces by Piet Mondrian,
who is really worth checking out
if you like this style of art!

To which my answer was “fascinating! I haven’t the foggiest idea. Let’s figure out!”. I don’t do visual stuff very much but I knew that this was a good opportunity to use my graphics gem.

Normally, my graphics gem is meant for doing visualizations of simulations, or other mathy things, or even games… but art? I hadn’t…

BigBinary Blog 

Using Concurrent Ruby in a Ruby on Rails Application

Concurrent Ruby is a concurrency toolkit that builds on a lot of interesting ideas from many functional languages and classic concurrency patterns. When it comes to writing threaded code in Rails applications, look no further since concurrent ruby is already included in Rails via Active Support.

Using Concurrent::Future

In one of our applications, to improve performance we added threaded code using Concurrent::Future. It worked really well for us until one day it stopped working.

“Why threads?” one might ask. The code in question was a textbook threading use case. It had a few API calls, some DB requests and finally an action that was performed on all the data that was aggregated.

Let…

Ruby Tuesday 

Issue #12

Welcome back after a longer break! I feel like much less things were happening in Ruby in recent weeks and there was not enough material to share here. And since I don’t want to force frequent issues over the quality, I decided to wait until the content queue fills up.

Let’s start with two posts from Janko Marohnić:

  • First one is quite old and it is a introductory post about ImageProcessing – his library to, well, process images. It reached 1.0 in April and Janko shares why he created it and how it’s different/better than existing solutions.
  • More recent post is a roundup of existing HTTP client libraries with some comparisons and a compelling analysis why http.rb is (maybe) the best…

Other things:

  • You probably have heard about guilds coming in Ruby 3. Today first code was revealed in one of the forks, owned by Koichi Sasada. Here is a comparison against master. Be warned though that it’s C code and understanding it is not necessarily easy.
All Ruby Podcasts by Devchat.tv 

RR 365: Should I Use Ruby on Rails with Nathan Kontny

Panel:

  • Charles Max Wood
  • Dave Kimura
  • Eric Berry
  • David Richards

Special Guests: Nathan Kontny

In this episode of Ruby Rogues, the panelists talk to Nathan Kontny about his video Should I use Ruby on Rails? Nathan has been a Rails developer since about 2005 when he created a startup and has since been making software and starting business. He has just recently been running the CRM Highrise and is now onto more projects elsewhere. They talk about his prior experiences as a software developer, why he chose to use Rails when creating software, and much more!

In particular, we dive pretty deep on:

Ruby Together News 

May 2018 Monthly Update

Hello! Welcome to the monthly update. During May, our work was supported by GitLab, Stitch Fix, and many others.

ruby together news

In May, Ruby Together was supported by 77 different companies, including Sapphire member Stripe. Murb and StackPath joined as Onyx members, and developer Gregory Brown (@practicingdev) became a member.

We were supported by a total of 86 individual members and 68 friends of Ruby Together. Thanks to all of our members for making everything that we do possible.

In community events news, our developer evangelist PJ Hagerty spoke at MalmoRB and Ruby Ireland, and visited CopenhagenRB among other Meetups.

Meanwhile, the Ruby Google Summer of Code projects made…

Jekyll • Simple, blog-aware, static sites 

Jekyll 3.8.3 Released

This release fixes a regression in 3.8 where collections with published: false do not show when using the --unpublished flag.

Thanks to @philipbelesky for reporting and fixing this issue; collections with published: false now behave the same way as Posts.

BigBinary Blog 

Modelling state in Elm to reflect business logic

We recently made ApiSnapshot open source. As mentioned in that blog we ported code from React.js to Elm.

One of the features of ApiSnapshot is support for Basic Authentication.

ApiSnapshot with basic authentication

While we were rebuilding the whole application in Elm, we had to port the “Add Basic Authentication” feature. This feature can be accessed from the “More” drop-down on the right-hand side of the app and it lets user add username and password to the request.

Let’s see how the Model of our Elm app looks.

type alias Model =
    { request : Request.MainRequest.Model
    , response : Response.MainResponse.Model
    , route : Route
    }

Here is the Model in Request.MainRequest module.

type alias APISnapshotRequest
Drifting Ruby Screencasts 

User Notifications

Using the Notifications Rails Engine, we are able to add notifications to our applications based on certain events. The engine provides the schema and necessary controls and associations to seamlessly integrate into your app.
bogdanvlviv / Bogdan 

Build your own tools

There are a lot of tools for building some specific things. If you need to build something, you should choose a tool.

The main idea of this post is to say - “Choose or build tool that would work for you”.

Sometimes you might feel that none of the tools you know don’t satisfy all your needs, or just you feel that you don’t enjoy the process by doing things with a tool. You might feel that a tool isn’t flexible enough or you have another reason not to use it. In that case, build your own tool. At least it should be fun.

In 2017 I gave a talk for the first time. I needed to choose a tool in order to prepare slides. I tried out some tools like Google Slides, and similar. They…

Janko’s Blog 

Http.rb is Great

The Ruby ecosystem has many HTTP clients gems to choose from. Some are built on libcurl (Typhoeus, Curb, Patron), some on Ruby’s Net::HTTP (RestClient, HTTParty, Nestful), some in pure Ruby (HTTPClient, Excon, http.rb), and some are wrappers around existing libraries (Faraday, HTTPI).

Taxonomy of Ruby HTTP client libraries

Over the years I’ve had the opportunity to try out most of these libraries, but ever since I discovered http.rb a year ago, it’s been my favourite HTTP client library. So, in this post I would like to talk about the features that make http.rb stand out for me.

Net::HTTP

Before we start, I would like to say a few words about Net::HTTP. Net::HTTP is the HTTP client that comes with the Ruby standard…

avdi.codes 

Making local friends: a technical breakdown

This post is not about a technical subject, but it's subject that I think affects a lot of people in the technical industry.

Someday you're going to need a friend

About a year ago my life took a turn for the not-so-happy. At that time and in the months after, I found out how blessed I am to have a large network of wonderfully supportive friends online. Many of them are people I primarily knew in a professional context, but who quickly and generously offered their time, their ears, and their words of support.

On the other hand, I also realized just how abjectly I had failed at building a local community of friends. It wasn't something I had ever prioritized, and since moving from…

BigBinary Blog 

RubyKaigi 2018 Day two

RubyKaigi is happening at Sendai, Japan from 31st May to 2nd June. It is perhaps the only conference where one can find almost all the core Ruby team members in attendance.

This is Prathamesh. I bring you live details about what is happening at the Kaigi over the next two days. If you are at the conference please come and say “Hi” to me.

Check out what happened on day 1 .

Faster Apps, No Memory Thrash: Get Your Memory Config Right by Noah Gibbs

Noah gave an awesome talk on techniques to manage the memory used by Ruby applications. One of the main point while dealing with GC is to make it run less, which means don’t create too many objects. He also mentioned that if application permits…

Speedshop - Ruby on Rails performance consulting 

The Complete Guide to Rails Performance, Version 2

Today, the Complete Guide to Rails Performance has been updated to version 2.0. You can purchase it here.

All existing purchasers have had their copies updated on Gumroad. When I started this project, I always believed that a digital course should be better than a typical paperback programming book. That’s why I don’t include any DRM or proprietary video codecs. That’s why I think, like most software, updates should be free.

“Version 2.0” isn’t quite as drastic a change as a software v2.0, though. The world of Rails performance has actually changed very little since I wrote the course 2 years ago. The apps I consult on still have many of the same problems. The V2 update reflects this: I…

The Bike Shed 

156: It's a Commercial Enterprise (Olivier Lacan)

We speak with Olivier Lacan about KeepAChangelog.com, tooling improvements for better developer experience, and the emotional impact of shutting down CodeSchool.com

BigBinary Blog 

Using Logtrail to tail log with Elasticsearch and Kibana on Kubernetes

Monitoring and Logging are important aspects of deployments. Centralized logging is always useful in helping us identify the problems.

EFK (Elasticsearch, Fluentd, Kibana) is a beautiful combination of tools to store logs centrally and visualize them on a single click. There are many other open-source logging tools available in the market but EFK (ELK if Logstash is used) is one of the most widely used centralized logging tools.

This blog post shows how to integrate Logtrail which has a papertrail like UI to tail the logs. Using Logtrail we can also apply filters to tail the logs centrally.

As EFK ships as an addon with Kubernetes, all we have to do is deploy the EFK addon on our k8s…

Sam Saffron 

An analysis of memory bloat in Active Record 5.2

Current patterns in Active Record lead to enormous amounts of resource usage. Here is an analysis of Rails 5.2


One of the very noble goals the Ruby community which is being spearheaded by Matz is the Ruby 3x3 plan. The idea is that using large amounts of modern optimizations we can make Ruby the interpreter 3 times faster. It is an ambitious goal, which is notable and inspiring. This “movement” has triggered quite a lot of interesting experiments in Ruby core, including a just-in-time compiler and action around reducing memory bloat out-of-the-box. If Ruby gets faster and uses less memory, then everyone gets free performance, which is exactly what we all want.

A big problem though is that…

Ruby News 

Ruby 2.6.0-preview2 Released

We are pleased to announce the release of Ruby 2.6.0-preview2.

Ruby 2.6.0-preview2 is the second preview toward Ruby 2.6.0. This preview2 is released earlier than usual because it includes an important new feature, JIT.

JIT

Ruby 2.6 introduces an initial implementation of JIT (Just-in-time) compiler.

JIT compiler aims to improve performance of any Ruby program execution. Unlike ordinary JIT compilers for other languages, Ruby’s JIT compiler does JIT compilation in a unique way, which prints C code to a disk and spawns common C compiler process to generate native code. See also: MJIT organization by Vladimir Makarov.

How to use: Just specify --jit in command line or $RUBYOPT environment…

Awesome Ruby Newsletter 

Issue 107 - Coding Sidekiq Workers the Right Way

BigBinary Blog 

RubyKaigi 2018 Day one

RubyKaigi is happening at Sendai, Japan from 31st May to 2nd June. It is perhaps the only conference where one can find almost all the core Ruby team members in attendance.

This is Prathamesh. I bring you live details about what is happening at the Kaigi over the next three days. If you are at the conference please come and say “Hi” to me.

Matz’s keynote

RubyKaigi started with Matz’s keynote. He used lot of proverbs applying them to the Ruby language and software development.

He talked about one of the hardest problems in programming - naming with an example of yield_self. Matz added alias then to the yield_self method yesterday. He also discussed about googlability of the…

Ruby on Rails Podcast 

244: Rails Community Survey 2018

Kyle talks with Robby and Corinne from Planet Argon about what they learned with this year's Rails Community Survey.

Search Results for “ruby” – via @codeship 

Expanding Your Tech Stack with AWS Lambdas

Reading Time: 5 minutes

Let’s face it. Debugging performance issues is hard, but fixing them is even harder.

Let’s say you’ve found the offending code that’s slowing your app down. Eventually there comes a time when you find out that this speed bump of code is synchronous — or linearly executing. One of the most effective ways to remedy these problematic sections of code is to delegate the heaviest workloads for processing to a later time and place.

While there’s an endless amount of workload delegation solutions out there, the idea of executing code on third-party servers — also known as serverless functions — has become increasingly popular in recent years.

Serverless functions are…

GoRails Screencasts 

Direct Uploads with ActiveStorage

Learn how to enable direct uploads in the browser to Amazon S3 or DigitalOcean Spaces using Rails' new ActiveStorage library
Drivy Engineering 

Usage of Sidekiq middleware

At Drivy, we use a lot of background jobs, called from service objects, API calls, cron, etc.
A time came when we needed to add some context data across several of these code layers.

For instance, we have some context data we need to keep for auditing reasons. This data can originate from several points in the application: maybe from some part of the web application, from the mobile app, or from a service object.

We tried to find a way to keep this new context data through all code layers and jobs without having to resort to adding context data arguments everywhere.

We decided to use Thread.current objects to host this data for the current process.

CAVEAT: Using this kind of global

Ruby Weekly 

Matz accepts Kernel#then as an alias for Kernel#yield_self

#401 — May 31, 2018

Read on the Web

Ruby Weekly

'then' Is Now an Alias for 'yield_self' (in Ruby 2.6)Kernel#yield_self was added to Ruby 2.5 as a way to yield the receiver to the given block and return any onward result. It’s awesome but there have been doubts over its name. Matz has now considered things and has declared then as a suitable alternative.

Ruby Bug Tracker

Setting Up a BDD Stack on a Rails 5 App — Learn how to generate a new Rails 5 application with all the necessary tools to set up a behavior-driven development (BDD) flow - RSpec, Cucumber, FactoryBot, etc.

Marko Anastasov

The…

RubySec 

XSS via the 400 Bad Request page

BigBinary Blog 

Rails 5.2 introduces allow_other_host option to redirect_back method

Rails 5.0 had introduced redirect_back method to perform redirection to path present in HTTP_REFERER. If there is no HTTP_REFERER present, then site is redirected to fallback_location.

Now consider the following scenario.

In one of the searches on google.com, we see a link to bigbinary.com. On clicking the link, we are navigated to bigbinary.com.

When somebody gets redirected to bigbinary.com from google.com, the HTTP REFERER is set to google.com

If bigbinary.com uses redirect_back in its code then the user will get redirected to google.com which might be undesired behavior for some applications.

To avoid such cases, Rails 5.2 has added a flag allow_other_host to not allow redirecting…

All Ruby Podcasts by Devchat.tv 

RR 364: Why Won't Bundle Update? with Olivier Lacan

Panel:

  • Dave Kimura
  • Eric Berry
  • David Richards
  • Catherine Meyers

Special Guests: Olivier Lacan

In this episode of Ruby Rogues, the panelists talk to Olivier Lacan about his blog post Why Won’t Bundle Update? and related topics. Olivier was originally a designer/web developer who fell into Ruby around 2010 and has been working on Code School, which is sadly in the process of being shut down. They talk about what package managers are, where you would you see them normally in code, dependencies, gems, and much more!

In particular, we dive pretty deep on:

Semaphore CI Community Tutorials on Ruby 

Setting up a BDD Stack on a Rails 5 Application

This article is brought with ❤ to you by Semaphore.

This post is adapted from Rails Testing Handbook, a free ebook on building sustainable Rails apps with BDD.

In this tutorial, we will guide you through the process of generating a new Rails 5 application, with all the necessary tools to set up a behavior-driven development (BDD) flow.

We will set up 5 tools that represent the base of BDD development in Rails:

When you're finished setting up the project on your machine, we will set it up on Semaphore, and establish a fully automated continuous integration workflow.

System Prerequisites

To follow our guide, you need to have the…

RubyGuides 

Why Do We Use Nil?

I was having a chat with a friend about a piece of Ruby code & the topic of return values came up… …and of course, nil is always part of that conversation. Later that day, I was in bed about to go sleep, thinking, why do we use nil? I thought it would be a […]

The post Why Do We Use Nil? appeared first on RubyGuides. Don't miss your free gift here :)

All Ruby Podcasts by Devchat.tv 

MRS 046: Benjamin Wood

Panel: Charles Max Wood

Guest: Benjamin Wood

This week on My Ruby Story, Charles talks to Benjamin Wood. Ben and his brother Josh own a consultancy company together called Hint, where they specialize in upgrading Rails apps and run UpgradeRails.com. He first got into programming because he was interested in computer hardware and built a computer out of spare parts for fun as a child. They talk about what led him to Ruby and Rails, what he has learned in throughout his life, especially with running a business, and much more!

In particular, we dive pretty deep on:

Greater Than Code 

082: Effective Change in Communities and Cultures with Aurynn Shaw

Aurynn Shaw joins the show to talk about contempt culture, as well as why technology is political, and the cultural impact of DevOps.

We have interactive show transcripts! Powered by Gretta.


Support for the Greater Than Code podcast comes from O’Reilly Fluent and Velocity conferences, coming to San Jose, California, June 11-14. Join us for hands-on training to help you improve performance, resilience, and user experience. Learn from the experts – like Lin Clark, Sarah Federman, Seth Vargo, and Julia Grace. Register now with code GTC20 to save up to $519 on your pass. Learn more at oreilly.com/bettertogether.


Panelists:

Sam Livingston-Gray | Coraline Ada Ehmke | John K. Sawers

Guest…

dejimata 

Arel with Wharel

Object Relational Mappers (ORM) are complex things. As the term implies, an ORM provides a mapping from objects in an object-oriented language like Ruby to a relational persistence layer. In theory, this makes it possible to abstract away details of this layer behind objects; in practice, of course, things are not so simple.

In this post, I’ll show you how I’ve leveraged a couple very simple features of Ruby’s object model to simplify building queries in ActiveRecord, in the form of a teeny tiny gem called Wharel. Wharel allows you to create Arel predicates in blocks passed to ActiveRecord query methods, without all the standard boilerplate.

Before I explain Wharel, though, let’s take a…

BigBinary Blog 

Faster JSON generation using PostgreSQL JSON function

There are various ways to generate JSON in Rails. There is to_json method built in Rails. We can also use jbuilder gem or active model serializer gem which can help us achieve the same.

As the number of records in the database grow, Rails can take a very long time to generate a response. The bottleneck can generally be traced back to JSON generation.

Recently, in one of our applications, we faced this issue where a page was taking too long to load. The load time was critical for us as this was the most visited page on the site. The page was loading a race, its racers and their lap details.

The page was loading fine for short races, with 10-15 racers and each racer having 30-50 laps. But…

Appfolio Engineering 

Upgrading Rails 4 Controller Tests to Rails 5

At AppFolio, we're finally in the process of upgrading many of our Rails applications from Rails 4.2, up to Rails 5.2. Our first, and biggest step is to upgrade to Rails 5.0. While there are many parts necessary to complete this upgrade, I would like to share a few things we have done specifically to address the backwards incompatibility Rails 5 introduced in controller tests.

In case you aren't aware, it was common in Rails 4 to write controller test request methods in the following syntax:

get image_path, id: '12'

In addition to providing a params hash, perhaps you wanted to include something in the request's session, and pre-set a flash message as well. That can be accomplished via:

get…
Ruby Magic by AppSignal 

Ruby's magical Enumerable module

It’s time for another episode of Ruby Magic! This time, we’ll look at one of Ruby’s most magical features, which provides most of the methods you’ll use when working with Ruby’s enumerable classes like Array, Hash and Range. In the process, we’ll learn what you can do with enumerable objects, how enumeration works, and how to make an object enumerable by implementing a single method.

Enumerable, #each and Enumerator

Enumeration refers to traversing over objects. In Ruby, we call an object enumerable when it describes a set of items and a method to loop over each of them.

The built-in enumerables get their enumeration features by including the Enumerable module, which provides methods…

EquiValent 

Rails Bounded contexts - the simple way

This article is not finished yet !!!

This article is still in progress !!! Lot of developers asked me for a preview of this article that’s why I’m releasing it unfinished.

please check on later once it’s officially relased

The premiss of this article is to organize your business related classes to app/bounded_context/... while still keep your Rails related classes with correlation with Rails best practices.

If you do this right you will end up with a folder structure like this:

app
  views
    baskets
      show.erb
  models
    product.rb
    basket.rb
  controllers
    baskets_controller.rb
  bounded_context
    discounts
      basket_value.rb
      basket_serializer.rb
     …
EquiValent 

How to become Ruby on Rails developer

blaaa


sources

EquiValent 

Content-Type application/json by default in Rails 5

Imagine you generate Rails API only app (rails new --api) and now you want all the requset been considered as JSON content-type (even if the header is not present in the request)

So when you do:

curl -XPOST localhost:3000/email_authentication -d '{"email": "tomas"}'

… it would be same as doing:

curl -XPOST localhost:3000/email_authentication -d '{"email": "tomas"}' -H 'Content-Type: application/json'

Rails by default has content-type: application/x-www-form-urlencoded

Now you may see some tutorials that poins you to just do:

 # app/controllers/application_controller.rb
 class ApplicationController < ActionController::Base
		respond_to :json
		before_action…
Andy Croll 

Active Record’s first and last may not mean what you think

Each Active Record model comes with the well-used ‘get me a single record’ scopes: .first and .last.

Instead of…

…using the methods directly on the base ActiveRecord class.

User.first
User.last

Use…

…them only with ordered scopes. Ideally with named concepts.

app/models/user.rb

class User < ActiveRecord::Base
  scope :by_created, -> { order(created_at: :asc) }
  scope :earliest_created, -> { by_created.first }
  scope :most_recently_created, -> { by_created.last }
  # ...
end

User.most_recently_created

But why?

This is mostly about making the code more explicit.

The .first and .last methods, when called on a bare Active Record model scope, mean the ‘lowest id’ and the ‘highest

Karol Galanciak - Ruby on Rails and Ember.js consultant 

The Case for before_validation callback: complex state normalization

Few months ago I wrote a blog post about ActiveRecord before_validation callback and how it is used for wrong reasons and concluded that in most cases this is not something we should be using routinely. However, I missed one appropriate use case for it which might be quite common in Rails apps, so this might be an excellent opportunity to get back to before_validation callback and show its other side.

Anatomy Of The Problem

Imagine that we have a Payment model where we need to store amount and currency. However, for statistical purposes, we also want to store normalized amount in USD currency with exchange rate applied at the time of payment’s creation. As this is a significant part…

Riding Rails 

Enumerable#index_with, transaction fixes, and more!

Hello everyone! This is Eugene, with a roundup of the last two weeks of activity in the Rails world. Let’s get started!

This Week’s Contributors

In the last two weeks, Rails saw contributions from 29 people, including 10 first-time contributors. Thank you all!

If you’d like to be included here, why not check out the list of open issues?

Add Enumerable#index_with

This new method converts an enumerable to a hash, where the keys are the enumerable’s elements and the values are determined by the provided block or argument.

Action Mailer now eager loads the mail gem

Loading the mail gem during boot avoids burdening the first request with the responsibility, and conveniently sidesteps a…

The Bike Shed 

155: Abstractions on Abstractions (Alex Sullivan)

Amanda is joined by Alex Sullivan, Android developer at thoughtbot, to discuss the state of React Native and its new competitor from Google, Flutter.

BigBinary Blog 

APISnapshot built using Elm and Ruby on Rails is open source

APISnapshot is built using Elm and Ruby on Rails. Today we’re happy to announce that the code is publicly available on GitHub.

We built APISnapshot for two reasons.

We wanted to work with Elm.

We wanted to have a tool that is easy to use and that will help us capture what response we are getting from the API in a format that is easy to share in github issue, in slack or in an email. As a consulting company we work with various teams around the world and during development phase either API is unstable or they do not do what they should be doing.

We originally built this tool using React. Elm compiler is quite strict and forced us to take into consideration all possibilities. This lead us…

Martian Chronicles, Evil Martians’ team blog 

TestProf II: Factory therapy for your Ruby tests

Author: Vladimir Dementyev, Back-end Developer at Evil Martians

Learn how to bring your Ruby test suite back to full health, and full speed, with TestProf—a bag of powerful tools to diagnose all test-related problems. This time, we talk about factories: how they can slow down your tests, how to measure that negative impact, how to avoid it, and how to make your factories as fast as fixtures.

TestProf, used on many Evil Martians’ projects to shorten a TDD feedback loop, is a must-have tool for any Rails (or another Ruby-based) application whose tests take more than a minute to run. It works with both RSpec and minitest by extending their functionality.

In our introductory article,…

Awesome Ruby Newsletter 

Issue 106 - RailsConf 2018 videos

Anthony Super 

Monads. But Backwards

It’s basically impossible to write anything that tries to introduce people to monads. It’s a rather famous curse. Heck, the Haskell wiki specifically says that “Monads are not a good choice as a topic for your first Haskell blog entry”.

This is my first Haskell blog entry. It’s going to be about Monads.

I do have something slightly novel to bring to the able, though: I’m going to do it backwards. Let’s begin.

At a high level: Crap we don’t want to deal with

Let’s say I’m a programmer, and there’s some crap I have to deal with. This describes quite a lot of programming, actually. Maybe I have a problem where some values might be missing. Maybe there’s possibly errors that I’ll…

Scout ~ The Blog 

Finding slow ActiveRecord queries with Scout

Once your Rails app begins seeing consistent traffic, you're bound to have slow SQL queries. While PostgreSQL and MySQL can log slow queries, it's difficult to gleam actionable information from this raw stream. The slow query logs lack application context: where's the LOC generating the query? Is this slow all of the time, or just some of the time? Which controller-action or background job is the caller?

Enter Scout.

Scout and the scout_apm gem help you prioritize your database optimization efforts. Once the gem is installed and the database monitoring addon is enabled, Scout continually analyzes your SQL queries. Slow queries are bubbled up as insights on your app dashboard:

Queries…

JRuby.org News 

JRuby 9.2.0.0 Released

The JRuby community is pleased to announce the release of JRuby 9.2.0.0

JRuby 9.2.x is our new major version of JRuby. It is expected to be compatible with Ruby 2.5.x and stay in sync with C Ruby. JRuby 9.2.0.0 is our first release for 2.5 support.

If you do find issues then report them on using our issue tracker at http://bugs.jruby.org. We also encourage users to join our IRC channel (#jruby on Freenode) and mailing lists. You may also follow @jruby on Twitter for updates.

Highlights:

  • Ruby 2.5 language and stdlib support
  • Improved support for non-ASCII identifiers and symbols
  • Improved Ruby method…

Github Issues resolved for 9.2.0.0

EquiValent 

Rails Bounded Contexts

Rails Bounded contexts - the simple way

This article is not finished yet !!!

This article is still in progress !!! Lot of developers asked me for a preview of this article that’s why I’m releasing it unfinished.

please check on later once it’s officially relased

The premiss of this article is to organize your business related classes to app/bounded_context/... while still keep your Rails related classes with correlation with Rails best practices.

If you do this right you will end up with a folder structure like this:

app
  views
    baskets
      show.erb
  models
    product.rb
    basket.rb
  controllers
    baskets_controller.rb
  bounded_context
    discounts
     …
RubyMine Blog 

Improved YAML Support in the Updated RubyMine 2018.2 EAP

Hey all,

RubyMine 2018.2 EAP (build 182.2574.11) has just been updated. The new build improves YAML support across all IntelliJ-based IDEs, and RubyMine is no exception. Apart from that, the new build also provides new intention actions for Ruby.

Download RubyMine 2018.2 EAP

Code insight for YAML anchors and aliases

Autocompletion

Once you’ve defined an anchor in your document, you can autocomplete its aliases simply by pressing Enter, instead of typing them out:

Code navigation

This trademark feature of all JetBrains IDEs now works for aliases. Press C…

RubyGarage Blog 

International Ruby Conferences Summer 2018

.blog-header__title{max-width: 520px;} Have you made your plans for this summer? We’re not talking about your vacation but rather about hot Ruby events coming soon. We’ve prepared a list of nine high-level conferences you can’t miss. Get familiar with different perspectives, talk over projects with other Rubyists, ask questions, solve problems, and learn. #1 RubyC https://rubygarage.s3.amazonaws.com/uploads/article_image/file/1458/ruby-c.jpg When: June 2–3 Where: Kyiv, Ukraine RubyC is the biggest Ukrainian conference on Ruby, Rails, and related technologies. The conference encourages Rubyists to collaborate and learn from each other. RubyC will host Ruby enthusiasts from all over the…
Ruby Weekly 

Actionable tips to improve web performance with Rails

#400 — May 24, 2018

Read on the Web

Ruby Weekly

Actionable Tips to Improve Web Performance with Rails — Based on a talk from Wroclove.rb, the tools and tricks listed here will result in better Rails and general Web performance.

Radek Markiewicz

▶  The Future of Rails 6: Scalable by Default — Is Rails ‘Fisher Price infrastructure’ or can it scale? It can, but it’s not as easy as it should be yet. This talk looks at efforts being made to make Rails 6 the most scalable version ever.

Eileen Uchitelle

Ultra-fast Hosting for Ruby Apps with Predictable Pricing — Spin up Ruby cloud servers with industry…

BigBinary Blog 

Generating filmstrip using puppeteer for better debugging

We are writing a lot of automation tests using Puppeteer.

Since puppeteer scripts execute so fast certain tests fail when they should be passing. Debugging those tests can be a challenge.

Chrome devtools comes with filmstrip feature. In “Performance” tab we can see screenshots of the site as they change over time.

We wanted puppeteer to generate similar filmstrip so that we can visually identify the source of the problem.

It turns out that puppeteer makes it very easy. Here is the full code.

import puppeteer from 'puppeteer';

(async () => {
  const browser = await puppeteer.launch({headless: false});
  const page = await browser.newPage();
  await page.setViewport({ width: 1280, height
example.com 

The Art of Asking

I’ve watched this amazing talk by Amanda Palmer a number of times. It’s about asking for what you need/want and trusting that you’ll get the support you need from your fans/base. It is really good:

I have always been an open source developer. I was first published on a CDROM (remember those?!?) that went out in a magazine (remember those?!?) in the early-to-mid 90s. I’ve been writing open source since before the term was coined. Since before we had the actual licenses (it was just called freeware or public domain back then and mine just happened to ship with the source). Giving away my software for free for the benefit of others is something that is in my blood and…

Then the…

Test Double | Our Blog 

Do we need dependency injection in Ruby?

Let's start this with a quick example. You're selling clothes, and your Shirt class looks something like this:

# In real life, these two classes/methods would call an API or something
# Let's ignore those details though :)
class Inventory
  def self.check_availability(product_code); end
end
class Purchaser
  def self.purchase_item(product_code); end
end

class Shirt
  def initialize(product_code)
    @product_code = product_code
  end

  def buy!
    if Inventory.check_availability(product_code)
      Purchaser.purchase_item(product_code)
      true
    else
      false
    end
  end

  private

  attr_reader :product_code
end

...and, you've got some tests that looks like this:

require 'rsp…
GoRails Screencasts 

Realtime SSH Logs with ActionCable

Streaming realtime progress to the browser is easy with ActionCable. This episode covers how we send over SSH logs in realtime inside Hatchbox.io
RubyGuides 

How To Use The Singleton Pattern In Ruby (And Why You Should Avoid It)

Have you ever wanted to create a class that can only have one instance? No? Me neither. But that’s exactly what the singleton pattern is. Some people even call this an anti-pattern! Let’s have a look at a code example, so you know what it looks like. Singleton Pattern Code Example The idea of the […]

The post How To Use The Singleton Pattern In Ruby (And Why You Should Avoid It) appeared first on RubyGuides. Don't miss your free gift here :)