Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Red Panthers 

Refactoring in Rails

 

When the complexity of our Rails application increases, it becomes difficult to test and add new features. As we know, Rails is built on the principle of convention over configuration. Putting too much logic in the controller will eventually violate the single responsibility principle making future changes to the code base difficult and error-prone. Refactoring the code helps for quality, clarity, and maintainability.

When should we refactor?

Tests usually run faster with well-isolated code. Slow running tests indicate the need of more sophisticated design. For example, each class should be concerned about one unique functionality. Also, models and controllers with too many lines of code…

Ruby Together News 

August 2017 Monthly Update

Hello! Welcome to the monthly update. During August, our work was supported by reinteractive, Stripe, Gitlab, Travis CI, Bleacher Report, and many others.

ruby together news

In August, Ruby Together was supported by 83 different companies, including Sapphire member Stripe. 2 companies joined as new members last month, including our first ever Ruby member, reinteractive!

On top of those companies, 2 new developers joined as friends of Ruby Together. In total, we were supported by 105 individual members and 72 friends of Ruby Together. Thanks to all of our members for making everything that we do possible. <3

In Ruby Together news, we successfully wrapped up a summer of full-time work…

Greater Than Code 

047: Communicating Across Boundaries with Declan Whelan

Panelists:

Janelle Klein | Sam Livingston-Gray | Jessica Kerr | Coraline Ada Ehmke

Guest Starring:

Declan Whelan: @dwhelan | Leanintuit

Show Notes:

00:16 – Welcome to “I Rolled a Natural 20 For My Agility Check” …we mean, “Greater Than Code!”

01:31 – Background and Superpower; Empathy

09:08 – Cross-Cultural Communication Dynamics

Women in Agile

15:48 – Biases, Understanding Dynamics, and Facilitating as an Ally

21:02 – Being Authentic

25:31 – Is Agile something that you are or something that you do?

35:37 – Adopting Practices Across Teams

A foolish consistency is…

The Bike Shed 

124: Nope. Nope. Nope. Nope.

We go inside the RubyConf CFP review process before turning our attention to questions about the impact of code review. Stick around post credits for some spoiler-filled, lukewarm Game of Thrones takes.

Tech Tips and Freebies – Rubyroid Labs Blog 

Ruby 2.4.2 has been Released

Reading Time: 1 minute

Ruby 2.4.2 has just been released. Let’s see what it has brought about inside.

This release of Ruby is mostly focused on security issues. So it is highly important to update your framework to this version to protect your system and your data. Here are the most important updates from the new version.

1. Buffer underrun vulnerabilities

A few Buffer underrun vulnerabilities have been fixed in the new version. One of them is concerning the sprintf method of Kernel module. Previously if a malicious format string with a precious specifier (*) was passed together with a large minus value, the interpreter could have crushed. Now the issue is solved.

Another problem solved is…

BigBinary Blog 

DateTime#to_time and Time#to_time preserves receiver's timezone info in Ruby 2.4

This blog is part of our Ruby 2.4 series.

In Ruby, DateTime#to_time and Time#to_time methods can be used to return a Time object.

In Ruby 2.3, these methods convert time into system timezone instead of preserving timezone of the receiver.

Ruby 2.3

> datetime = DateTime.strptime('2017-05-16 10:15:30 +09:00', '%Y-%m-%d %H:%M:%S %Z')
 #=> #<DateTime: 2017-05-16T10:15:30+09:00 ((2457890j,4530s,0n),+32400s,2299161j)>
> datetime.to_time
 #=> 2017-05-16 06:45:30 +0530

> time = Time.new(2017, 5, 16, 10, 15, 30, '+09:00')
 #=> 2017-05-16 10:15:30 +0900
> time.to_time
 #=> 2017-05-16 06:45:30 +0530

As you can see, DateTime#to_time and Time#to_time methods return time in system timezone +0530.

GoRails Screencasts 

Sortable Drag and Drop

Drag and drop sorting is pretty easy to add to any Rails application using jQuery sortable
Red Panthers 

Getting started with Angular 4

Angular is a most popular platform for building applications with the web. Angular empowers developers to build applications that live on the web, mobile, or the desktop. The AngularCLI is a command line interface tool that can create a project, add files, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.

As compared to the older versions of Angular, there are many new things added to the list. Not only new features but also some twists are there that enhance old features. Forget Angular 3, Google jumps straight to Angular 4 after Angular 2. Angular4 applications are much faster and less space consuming.  Angular4 is compatible with TypeScript’s…

Red Panthers 

Rails Generators

Rails generators are used to create many files for models, controllers, views, unit tests, migrations and more. It will do some of the manual work for us. So it saves time. They can also be used to set up some basic specs for the application test suite.

Running rails generate(or rails g) by itself gives a list of available generators:

$ rails generate
Usage: rails generate GENERATOR [args] [options]
...........
Rails:
assets
channel
controller
generator
helper
integration_test
jbuilder
job
mailer
migration
model
resource
responders_controller
scaffold
scaffold_controller
task
.............

The main generators that rails offers are:

  • controller: The Rails controller coordinates the interaction…
Ruby – Sihui Huang 

Intimidated by the Official Rails Guides? Here is the Cure.

TL;DR: how to study and master the Rails Guides to level up and become an intermediate Rails developer.

 

It’s a bit embarrassing to admit that I was scared of the official Rails Guides. I much preferred video tutorials and blog posts over the official doc. Becuase video tutorials and blog posts seemed less intimidating and more hand-holding.

I avoided the official Rails Guides like the plague. Whenever I saw recommended Rails resources, the Rails Guides was always on top the list. But I was so afraid of it that my brain would automatically filter it out and go check out other resources on the list.

I was able to get by with jumpstart tutorials and the help of StackOverflow. But I wasn’t…

Drifting Ruby Screencasts 

Polymorphic Associations

Advancing from Single Table Inheritance, learn how Polymorphic Associations differ and tricks to simplify their usage.
RubyBlog.pro 

How to protect naming conventions when working with microservices or third-party APIs

Naming things it's a hard task. Once you named something in the system, you want to follow this naming convention. Especially it's important if term comes from domain experts. But it's not that easy to keep naming right when you have to deal with third-party APIs or microservices.
zverok with ruby 

Making data API of MediaWiki sites

NB: This small case study was published as pre-RubyKaigi 2017 appetizer for my talk.

Wikipedia and its “sister sites” (Wiktionary, Wikivoyage, Wikisource etc.) currently is the most comprehensive index of entire human knowledge. This information is precious, yet hard to consume programmatically.

One reason is information’s informal, “human-first” structure—yet it turns out there are a lot of established patterns and enough of formalities to be useful in automated environments.

But another problem of access to the knowledge is lack of the tool for MediaWiki markup parsing, which is surprisingly hard. The thing is, markup has grown organically, and, with time, from simple “text with…

ruby – Bibliographic Wilderness 

Consider TTY::Command for all your external process/shell out needs in ruby

When writing a ruby app, I regularly have the need to execute and wait for an external non-ruby “command line” process. Sometimes I think of this as a “shell out”, but in truth depending on how you do it a shell (like bash or sh) may not be involved at all, the ruby process can execute the external process directly.  Typical examples for me are the imagemagick/graphicsmagick command line.

(Which is incidentally, I think, what the popular ruby minimagick gem does, just execute an external process using IM command line. As opposed to rmagick, which tries to actually use the system C IM libraries. Sometimes “shelling out” to command line utility is just simpler and easier to get right).

There…

Red Panthers 

PostgreSQL 9.6 new features

POSTGRESQL is an open-source object-relational database system. It is not controlled by any corporation or other private entity. The source code is available free of charge. PostgreSQL supports transactions, subselects, triggers, views, foreign key referential integrity, and sophisticated locking.

New features in Postgres are:

  • Parallel execution of sequential scans, joins and aggregates.
  • Avoid scanning pages unnecessarily during vacuum freeze operations.
  • Synchronous replication now allows multiple standby servers for increased reliability.
  • Full-text search can now search for phrases (multiple adjacent words).
  • postgres_fdw now supports remote joins, sorts, UPDATEs, and DELETEs.
  • Substantial…

Parallel execution of sequential scans, joins and aggregates

PostgreSQL can devise query plans which can leverage multiple CPUs in order to answer queries faster. This feature is known as the parallel query. Mostly, queries that touch a large amount of data…

Hi, we're Arkency 

Rails components — neither engines nor gems

There has been a very interesting discussion today on #ruby-rails-ddd community slack channel. The topic circulated around bounded contexts and introducing certain “component” solutions to separate them.

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! Apply!

There are various approaches to achieve such separation — Rails Engines and CBRA were listed among them. It was, however, the mention of “unbuilt gems” that reminded me of something.

Gem as a code boundary

Back in the day, we had an approach in Arkency in…

Hi, we're Arkency 

Physical separation in Rails apps

I’ve been just following an interesting discussion within our Rails/DDD community. The particular topic which triggered me was a debate what kind of separation is possible within a Rails app which aims to be more in the DDD spirit.

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! Apply!

I remember, back in the school, I was taught about the difference between the physical separation of components vs conceptual separation. This was a part of a software engineering class I took. I hope I got it right.

If we…

Red Panthers 

Web Frameworks in Crystal

 

The creator of Ruby, Yukihiro Matsumoto said that the language was made to make programmers happy. Imagine a language as elegant as Ruby and blazingly fast as C. If you already love Ruby, may be it is time to start considering Crystal lang, the younger sibling of Ruby. It is a compiled language which is syntactically very similar to Ruby and designed for high throughput and performance.

Features

  • Native websocket support
  • Compiles to efficient native code
  • Statically typed => if  any errors it will let you know at compile time.
  • Less memory consumption

Web frameworks in Crystal

Applications developed using framework are easy to maintain and upgrade at lower cost. This article lets you get…

Ruby – Sihui Huang 

Design Pattern: Simple Factory and Cheesecake Factory

Design Patterns in life and Ruby – gain an intuitive understanding of OO design patterns by linking them with real-life examples.

 

Factory Patterns are about encapsulating object creation.

But before diving into details of these patterns, let’s talk about cheesecakes. Because cheesecakes are about … happiness! 😝😋😍

Let’s focus our gaze at six of my personal favorites: Original Cheesecake, Ore0 Cheesecake, Coffee Cheesecake, Tiramisu Cheesecake, S’mores Cheesecake, and Hazelnut Cheesecake.

 

Here is how we make a cheesecake:

def make_cheesecake(type)
  cheesecake = nil
  
  case type
    when 'oreo'
      cheesecake = OreoCheesecake.new
    when 'coffee'
      cheesecake =…
Ruby Weekly 

#366: Ruby 2.4.2 Released With Multiple Security Fixes

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 366 — September 14, 2017
ruby-lang.org
The vulnerabilities include a buffer under-run vuln in Kernel.sprintf and RubyGems issues. Ruby 2.2.8 and 2.3.5 are also out for the same reason.


Sandi Metz
Three metrics that can be combined to measure the maintainability of your code and find outliers of complexity.


Brakeman Pro  Sponsored
Cross-site scripting (XSS) is the most common web vulnerability and Rails applications are not immune. Learn how XSS can sneak into Rails apps and how…
Search Results for “ruby” – via @codeship 

Understanding Lifetimes in Rust

Reading Time: 6 minutes

With the convenience of higher level languages that handle the scope of how long each object in our code base exists, many of us have not needed to learn nor understand lifetimes of objects beyond understanding scopes themselves. Rust likewise manages lifetimes for us, where we have more control of simple situations via ownership and borrowing. In more complex situations, however, we need to give identifying marks in the code to allow the compiler to understand a greater scope of a lifetime.

In simple terms, this all comes down to freeing up memory once the code base is done with it. Higher level languages, such as Go, Ruby, or Python, use garbage collectors that mark…

Ruby News 

Ruby 2.4.2 Released

We are pleased to announce the release of Ruby 2.4.2. This release contains some security fixes.

There are also many bug-fixes. See commit logs for more details.

Known Problem

(This section was added at September 15, 2017.)

An incompatibility has been found for Ruby 2.4.2. Ruby 2.4.2 can not link with libgmp nor jemalloc. We…

Ruby News 

CVE-2017-14064: Heap exposure vulnerability in generating JSON

There is a heap exposure vulnerability in JSON bundled by Ruby. This vulnerability has been assigned the CVE identifier CVE-2017-14064.

Details

The generate method of JSON module optionally accepts an instance of JSON::Ext::Generator::State class. If a malicious instance is passed, the result may include contents of heap.

All users running an affected release should either upgrade or use one of the workarounds immediately.

Affected Versions

  • Ruby 2.2 series: 2.2.7 and earlier
  • Ruby 2.3 series: 2.3.4 and earlier
  • Ruby 2.4 series: 2.4.1 and earlier
  • prior to trunk revision 58323

Workaround

The JSON library is also distributed as a gem. If you can’t upgrade Ruby itself, install…

Ruby News 

CVE-2017-14033: Buffer underrun vulnerability in OpenSSL ASN1 decode

There is a buffer underrun vulnerability in OpenSSL bundled by Ruby. This vulnerability has been assigned the CVE identifier CVE-2017-14033.

Details

If a malicious string is passed to the decode method of OpenSSL::ASN1, buffer underrun may be caused and the Ruby interpreter may crash.

All users running an affected release should either upgrade or use one of the workarounds immediately.

Affected Versions

  • Ruby 2.2 series: 2.2.7 and earlier
  • Ruby 2.3 series: 2.3.4 and earlier
  • Ruby 2.4 series: 2.4.1 and earlier
  • prior to trunk revision 56946

Workaround

The OpenSSL library is also distributed as a gem. If you can’t upgrade Ruby itself, install OpenSSL gem newer than version…

Ruby News 

Ruby 2.2.8 Released

Ruby 2.2.8 has been released. This release includes several security fixes. Please check the topics below for details.

Ruby 2.2 is now under the state of the security maintenance phase, until the end of the March of 2018. After the date, maintenance of Ruby 2.2 will be ended. We recommend you start planning…

Ruby News 

Ruby 2.3.5 Released

Ruby 2.3.5 has been released.

This release includes about 70 bug fixes after the previous release, and also includes several security fixes. Please check the topics below for details.

See the ChangeLog for details.

Known Problem

(This section was added at September 15, 2017.)

An incompatibility has been found…

Ruby News 

CVE-2017-0898: Buffer underrun vulnerability in Kernel.sprintf

There is a buffer underrun vulnerability in the sprintf method of Kernel module. This vulnerability has been assigned the CVE identifier CVE-2017-0898.

Details

If a malicious format string which contains a precious specifier (*) is passed and a huge minus value is also passed to the specifier, buffer underrun may be caused. In such situation, the result may contains heap, or the Ruby interpreter may crash.

All users running an affected release should upgrade immediately.

Affected Versions

  • Ruby 2.2 series: 2.2.7 and earlier
  • Ruby 2.3 series: 2.3.4 and earlier
  • Ruby 2.4 series: 2.4.1 and earlier
  • prior to trunk revision 58453

Credit

Thanks to aerodudrizzt for reporting this…

History

Ruby News 

CVE-2017-10784: Escape sequence injection vulnerability in the Basic authentication of WEBrick

There is an escape sequence injection vulnerability in the Basic authentication of WEBrick bundled by Ruby. This vulnerability has been assigned the CVE identifier CVE-2017-10784.

Details

When using the Basic authentication of WEBrick, clients can pass an arbitrary string as the user name. WEBrick outputs the passed user name intact to its log, then an attacker can inject malicious escape sequences to the log and dangerous control characters may be executed on a victim’s terminal emulator.

This vulnerability is similar to a vulnerability already fixed, but it had not been fixed in the Basic authentication.

All users running an affected release should upgrade immediately.

Affected…

All Ruby Podcasts by Devchat.tv 

MRS 020: Ruberto Paulo

Tweet this Episode

Show Notes in Progress

All Ruby Podcasts by Devchat.tv 

RR 327: Hack Your Workday to Maximize Learning with Allison McMillan

Tweet this Episode

Show Notes in Progress

Schneems - Programming Practices, Performance, and Pedantry 

How August 2017 RubyGems Vulnerabilities were patched on Heroku

This is less a blog post and more of an FYI. This is pretty much verbatim of a snippit I wrote to respond to people asking about the Rubygems vulnerabilities. The TLDR; push to Heroku using any supported Ruby version and you’re safe. If you’re not using a supported Ruby version upgrade your app. The vulnerabilites were fairly low impact, but you should still take steps to protect yourself.

Search Results for “ruby” – via @codeship 

GraphQL and Performance in Rails

Reading Time: 5 minutes

We looked previously at getting set up with GraphQL on Rails. We defined some queries, some mutations, and had a good time doing so! But what if I told you that with only a few hundred records in the database, it’s possible to write a query that brings our server grinding to a halt?

In this article, we’ll look at three ways to avoid performance issues with GraphQL in your Rails app, and then at a tool to help monitor which queries are being executed against your GraphQL API.


“Three ways to avoid performance issues with GraphQL in your Rails app” via @leighchalliday
Click To Tweet


Avoiding N+1 Queries

An example of an N+1 query is when you’re trying to show something…

Hi, we're Arkency 

How mutation testing causes deeper thinking about your code + constructor for an included module in Ruby

This is a short story which starts with being very surprised by mutation testing results and trying to figure out how to deal with it.

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! Apply!

Consider this module from aggregate_root gem which is part of Rails Event Store.

module AggregateRoot
  def apply(event)
    apply_strategy.(self, event)
    unpublished_events << event
  end

  def load(stream_name, event_store: default_event_store)
    @loaded_from_stream_name = stream_name
    events = event_store.read_stre…
Blog - Sandi Metz 

Breaking Up the Behemoth

Good Morning,

I've been thinking about how applications evolve, and what we might do if we're unhappy with the results. Three apparently unrelated ideas have been percolating in my head. In this newsletter I'll introduce each one and connect them together, in hopes that understanding these connections will help us understand our apps.

These thoughts are very definitely my opinion, justified only by past experience. YMMV, but it'll give you something to think about. :-) Expect lots of pictures. Imagine me waving my arms and drawing on the whiteboard.

The first idea is Martin Fowler's Design Stamina Hypothesis.

#1: Design Stamina Hypothesis

Fowler illustrates this idea with the…

Valentino G's Blog 

A clear and concise introduction to testing Koa with Jest and Supertest

Photo Credit: Wikimedia Commons

Mocha and Chai are the way to go when it comes to testing a Node API but I couldn’t resist to give Jest a try. Lately I’ve covered Test Driven Development by building a basic RESTful API. My goal today? Rewrite a bunch of tests by switching to Jest and async/await.

As a web developer it’s crucial to be happy about your own code. But you should also prepare yourself to question your own approaches.

This is even more true in the Javascript’s land: the scene changes so fast! Sometimes that fancy new tool it’s worth a look, sometimes not. And Jest falls into the first category.

Requirements

To follow along you should have a basic understanding of Javascript and…

Red Panthers 

Event Listeners in VueJS

Vue.js is a Javascript framework for user interface. There are many directives in Vuejs. A directive’s job is to reactively apply special behavior to the DOM when the value of its expression changes. You can use the v-on directive to bind event listeners to DOM events.

<div id="example">
  <button v-on:click="clickme">Add 1</button>
  <p>The button above has been clicked {{ counter }} times.</p>
</div>

var example1 = new Vue({
  el: '#example',
  data: {
    counter: 0
  },
  methods : {
    clickMe : function(){
     this.counter += 1;
    }
  }
})

We are binding a click event listener to a method named clickMe. Here’s how to define that method in our Vue instance. Here we have a counter

Greater Than Code 

046: Specialization vs Collaboration with Aria Stewart

Panelists:

Coraline Ada Ehmke | Astrid Countee | Janelle Klein

Guest Starring:

Aria Stewart: @aredridel

Show Notes:

00:16 – Welcome to “The World is Upside Down. Can DevOps save us?” …we mean, “Greater Than Code!”

01:07 – Background and Superpowers

09:22 – Diagnostic Troubleshooting: “Expert Intuition Effect”

14:23 – Understanding Entire Systems vs Specializing in One Area

17:15 – Isolation Leading to Contempt

28:42 – The DevOps Movement and Culture Change

34:45 – Contempt Towards Processes

Janelle Klein: A Programmer’s Guide to Humans @ SeleniumConf UK

Reflections:

Astrid: Having a holistic approach towards Software Development.

Coraline: Why specialization leads to contemptuous behavior…

The Bike Shed 

123: Too Many Parameters

Derek and Sean discuss the troubles encountered when code reuse is a goal above all others and strategies to have your reusable cake and eat it too.

BigBinary Blog 

Using Recompose to build higher-order components

Recompose is a toolkit for writing React components using higher-order components. Recompose allows us to write many smaller higher-order components and then we compose all those components together to get the desired component. It improves both readability and the maintainability of the code.

HigherOrderComponents are also written as HOC. Going forward we will use HOC to refer to higher-order components.

Using Recompose in an e-commerce application

We are working on an e-commerce application and we need to build payment page. Here are the modes of payment.

  • Online
  • Cash on delivery
  • Swipe on delivery

We need to render our React components depending upon the payment mode selected…

Martian Chronicles 

git push --force and how to deal with it

Author:Andrey Novikov, Back-end Developer at Evil Martians

Have you ever found yourself in a situation where a wrong git command wreaked havoc on your project’s repo? People make mistakes, and sometimes those mistakes can cost hours of your team’s time. In this tutorial, we will show you how to recover from an unfortunate git push --force quickly.

Let’s not get overly confident. Sooner or later, this is going to happen. While working with several remotes in the same git repository, you will eventually git push --force into master (or another important branch that should never be messed with).

That may happen, for instance, when deploying with Deis or Heroku that use separate git…

Drivy Engineering 

Setting up Vim for React development

We’ve recently introduced Preact to our Rails stack at Drivy, and the results have been rather satisfying so far. As a Vim lover, I was curious to see how to setup Vim for working on a React (or React-like) project, and as usual, the wealth of plugins out there didn’t disappoint.

Here’s the setup that I came up with:

Syntax Highlighting

Let’s start with the basics, and get some syntax highlighting for javascript and JSX by adding these to the plugins section of your .vimrc:

Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'

I’m assuming here that you’re using vim-plug as your plugin manager, if you’re unsure about how to install these with another plugin manager, check out the readme…

Adrian Serafin 

preloading associations with dynamic condition in rails

N+1 queries issue

The N+1 query issue is common performance problem in Rails applications.

To better understand it let’s consider typical e-commerce application where we’re dealing with products with prices in multiple currencies.

  class Product < ActiveRecord::Base
    has_many :prices
  end
  
  class Price < ActiveRecord::Base
    belongs_to :product
    validates :currency_code, presence: true
  end

When we want to display all products and show price in USD we can do something like this

  Product.all.each do |product|
    product.prices.where(currency_code: 'USD').cents
  end

Above code will result in 1 query to fetch all products and 1 query for each product to fetch…

Hi, we're Arkency 

What I learnt from Jason Fried about running a remote/async software company

I’m running Arkency for 10 years now. Arkency is a remote company and an async company. We have created our own unique culture of working and collaborating. When we started, there weren’t really many sources to look up to in regards to remote work.

Basecamp (former name: 37 Signals) is such a company. They have existed before Arkency. They were kind enough to be very opinionated about the way they work, they blogged about their efforts. Not only Rails was an inspiration from Basecamp to Arkency, also the remote work was.

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join…
Ruby – Sihui Huang 

Frustrated Learning Rails? Here is What You Should Do.

You were new to Rails, Web Development, or even programming. But you decided to give Rails a try. You thought it might be challenging but doable, like climbing a hill.

Unfortunately, as you spent more and more time with Rails, things got more and more confusing. Each time when you were stuck and searched for a solution, you encountered some new words: Bundler, MVC, ERB, TDD, ActiveRecord Associations… There were conventions after conventions. You felt all you did was googling and copy-pasting and had trouble gluing all the components together. You started to lose confidence and wonder if you would ever learn Rails or Web Development.

I know how you felt because I was you couple years ago.…

Devon C. Estes - Articles 

Phoenix contexts aren't finished yet

Phoenix projects are structured like Elixir and any other Elixir project – we split our code into contexts. A context will group related functionality, such as posts and comments, often encapsulating patterns such as data access and data validation. By using contexts, we decouple and isolate our systems into manageable, independent parts. - the Phoenix guides

Drifting Ruby Screencasts 

Single Table Inheritance

Learn to use single table inheritance to allow multiple classes to be stored in the same database table.
Red Panthers 

Using mina to deploy a particular commit

Mina is our tool of choice when it comes to automating our deployment. It might not be the best tool out there, but it is enough to get us started. Single server or multi server, we love Mina.

In most of uses cases if something fail in production we just need to rollback to one or two version before to it. But recently we had a case in which we had to revert to version order than the previous 5 version (5 is default no of versions stored). The quick thing that we did at that point is copy of master called temp-master branch and changed master to the version that we wanted and had the new master deployed.

We didn’t like that solution much, so we decided to look for a cleaner solution.…

Ruby – Sihui Huang 

Design Pattern: Template Method and Chipotle

Design Patterns in life and Ruby – gain an intuitive understanding of OO design patterns by linking them with real-life examples.

 

Template Method is the most commonly used design pattern in programming and real life.

Before we dive into details of the pattern, let’s learn an important life lesson:

Chipotle 101: How to Order in Chipotle.

There are four steps involved:

  1. Choose a “vessel”: Burrito vs. Bowl vs. Tacos vs. Salad
  2. Add meat: Chicken vs Steak vs. Barbacoa vs. Carnitas vs. Vegetarian
  3. Add toppings: Tomato vs. Corn vs. Green Chili vs. Red Chili
  4. Add extras & drinks: Chips vs. Guacamole vs. Salsa vs. Beer vs. Soda

 

For example, my go-to order is Bowl + Steak + (Tomato + Corn) +…

All Ruby Podcasts by Devchat.tv 

MRS 019: My Ruby Story Eric Berry

MRS 019: Eric Berry

Today's episode of My Ruby Story is an interview with Eric Berry, who is our newest panelist on Ruby Rogues.

[01:10] Introduction to Eric

Eric is one of Chuck's friends from early in his programming career.

Eric is @coderberry on Twitter. He's been a Ruby developer for about 9 years and doing software for about 19 years.

[02:15] How Eric got into programming

He was hired to do HTML for a company called vLender. Eric worked in Photoshop 2 (pre-layers).

He, then, went on an LDS mission and while on his mission, he built a system to track the cars and assets for the mission.

Then, his brother moved out to Switzerland to join an eCommerce company. Eric bought a PHP…

Ruby Inside - Medium 

How to include Rails Associated Model Data in React components

TL;DR: Use jbuilder!

Originally published at learnetto.com

When you start using React with Rails, one of the frustrating problems you quickly run into is trying to access associated model data from your React component.

Let’s say we are building a chat app with Rails and React. We have three models, Chatroom, Message and User, which have the following relationships between them:

class Chatroom < ApplicationRecord
has_many :messages, dependent: :destroy
end

class Message < ApplicationRecord
belongs_to :chatroom
belongs_to :user
end

class User < ApplicationRecord
has_many :messages, dependent: :destroy
end

And we have a Message component for rendering individual messages:

import React from 'react'

co…
Red Panthers 

Two way binding in Vue.js

Vue.js is a JavaScript framework getting popular considering its simplicity praised a lot these days. There are a lot of JavaScript frameworks among which React and Angular are popular among web developers. Vue.js is much flexible and less opinionated framework than Angular. It’s similar to React but much simpler. Vue.js supports Two-way binding. That is it keeps your data in sync with your DOM without you having to do anything. Two-way binding in Vue.js is MVVM pattern. That is Model View View Model. Like MVC, Model is the data object and view is what is displayed up. The Model can tie to the View and the View can tie back to Model.

In one way binding, JS variable is bound to the DOM.

<div…
Hi, we're Arkency 

Making tmux work for you

When it comes to my developer toolset, I like solutions that I can easily understand and tweak. I guess I’m not the only one. I believe that for a lot of people one of the (many) reasons to join the Ruby bandwagon was that you could do virtually everything without a big, fat IDE, that I never know what it’s doing and how. Just your editor and console. First class citizens.

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! Apply!

Boring introduction

And I still like this kind of workflows. But, let’s be honest,…

All Ruby Podcasts by Devchat.tv 

RR 326: Chatbots with Jamie Wright

In this episode of the Ruby Rogues podcast Dave Kimura, Eric Berry, and Charles Max Wood discuss chatbots with Jamie Wright. Jamie will be speaking at Ruby Dev Summit in October.

[01:25] Jamie Wright introduction

Jamie is a professional nerd and independent contractor. He's been coding for 20 years mostly in Ruby. He's starting to get into Elixir.

One of his first projects was a text adventure game, which got him started with conversational UI's. He saw Hubot on Campfire. He started tweaking that.

He made a timetracking bot that used Freshbooks and Harvest.

Then Slack came out and he created Tatsu.

[05:00] Tatsu features

You can schedule it and it'll ask automated questions.

He's…

Riding Rails 

Rails 5.1.4 and 5.0.6 released

Hi everyone,

I am happy to announce that Rails 5.0.6 and 5.1.4 have been released.

CHANGES since 5.0.5

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

CHANGES since 5.1.3

To view the changes for each gem, please read the changelogs on GitHub:

Schneems - Programming Practices, Performance, and Pedantry 

Adding a Blog feature: 'Say my Name'

Do you have a hard name to pronounce? I know I do, and I’m constantly getting asked to say it for people. So much that I decided to add it to my blog. It was pretty easy and I don’t know why I didn’t do it sooner. This is a short post on the why and the how to add an audio clip to your “About” page.

Ruby – Sihui Huang 

When to Refactor

Keep hearing all these good things about refactoring but don’t know where to start?

Here are seven cases where refactoring can help.

 

Case 1: When you need to make a change but it’s difficult to do so.

Instead of trying to make a difficult change, first, refactor the code so you can make the change easily. Then make the easy change.

 

Case 2: When you need to understand a piece of code.

When trying to understand a piece of unfamiliar code, play around with the code first. If some parts of it require efforts to understand, try to refactor the…

Ruby – Sihui Huang 

Code Smell Cheat Sheet

Want to refactor some code but don’t know where to start? Just implemented a functionality and want to clean up the code? Need to review a gigantic pull request and find it hard to understand?

Start with spotting and removing code smells.

 

If it stinks, change it.Grandma Beck

 

I designed this cheat sheet to help you identify code smells1. The first column describes symptoms of a code smell. The second column lists the name of a code smell.

Use this cheat sheet to check your code every time you need to refactor it. Once you spot any of the described symptoms, you will now know the name of the smell and can research about how to remove the smell.

Download the Code Smell Cheat…

Ruby Weekly 

#365: Sequel 5.0.0 Released

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 365 — September 7, 2017
Practical AI
If you’re into AI, this is a fun exercise in writing a game player class in Ruby that can ‘learn’.


Universe Engineering
A follow up to a very popular article, this time looking at more advanced concurrency models such as Actors, CSP, STM and guilds.


John Cupitt
libvips is a fast, horizontally threaded image processing library that has over 300 operations. More info here.


Bugsnag  Spon…
Red Panthers 

Painless Cron jobs in Crystal using Schedule

Many Ruby developers use the awesome whenever gem for scheduling tasks in their projects, so do we and with ‘whenever’  scheduling tasks become so effortless that we absolutely loved it. Recently we have been deploying Crytal apps to production and Kemal is our framework of choice. During the process, we felt the urge to have something similar to whenever in Crystal for cron jobs and that’s when we discovered Schedule – a Crystal shard that provides a clear DSL to write periodic or scheduled tasks and there was no turning back.

Getting started

Add Schedule to your shard.yml file

dependencies:
  schedule:
    github: hugoabonizio/schedule.cr

you are all set to schedule your tasks, all you…

Greater Than Code 

Special Edition: Innovation Amidst a Disaster with Jeff Reichman

Panelists:

Jamey Hampton | Coraline Ada Ehmke | Astrid Countee | Janelle Klein

Guest Starring:

Jeff Reichman: @fileunderjeff | January Advisors | Sketch City

Show Notes:

In this special edition of Greater Than Code, we talk to Jeff Reichman, a technologist living in the Houston area who co-founded Sketch City, a non-profit community of 2,500+ people who apply technology and data to public problems.

This episode talks about how the Houston tech community came together to help people through Hurricane Harvey and the aftermath, the technology opportunities in disaster response, the harvey-api that they developed, and how tech devs need to be side-by-side with relief efforts, while responding…

JRuby.org News 

JRuby 9.1.13.0 Released

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

JRuby 9.1.x is our current major version of JRuby. It is expected to be compatible with Ruby 2.3.x and stay in sync with C Ruby. JRuby 9.1.13.0 is our latest release…

Major features of JRuby 9000:

  • Ruby 2.x compatibility
  • A new optimizing runtime based on a traditional compiler design
  • New POSIX-friendly IO and Process
  • Fully ported encoding/transcoding logic from MRI

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…

GoRails Screencasts 

Speed up Rails boot times with Bootsnap

Learn how Bootsnap speeds up your Ruby and Rails app boot times by preloading the load paths and caching Ruby bytecode
Tech Tips and Freebies – Rubyroid Labs Blog 

Welcome Release of Webpacker 3.0

Reading Time: 1 minute

Great news everyone, Webpacker 3.0 has just been released. 
Some time ago assets-pipeline was a revolution in the world of Ruby developers. But since then a lot of water has flown under the bridge and plenty alternatives have popped up, so it is really great that it was decided to change the approach and update the framework.

So what is the big news about Webpacker 3.0?

Well, first and foremost is that a separate process is no longer required for development. This will speed up the performance for small and medium-sized applications. For those with big apps, bin/webpacker-dev-server will still do. Webpacker will be able to automatically figure out whether the process…

Universe Engineering - Medium 

Introduction to Concurrency Models with Ruby. Part II

In the second part of our series we will take a look at more advanced concurrency models such as Actors, Communicating Sequential Processes, Software Transactional Memory and of course Guilds — a new concurrency model which may be implemented in Ruby 3.

If you haven’t read our first post in the series, I’d definitely recommend reading it first. There I described Processes, Threads, GIL, EventMachine and Fibers which I’ll be referring to in this post.

Actors

Actors are concurrency primitives which can send messages to each other, create new Actors and determine how to respond to the next received message. They keep their own private state without sharing it, so they can affect each other only…

Hi, we're Arkency 

How to setup development work with RailsEventStore and mutant

As Arkency we’re making our efforts to inculcate Domain Driven Design into Rails community. You should be familiar with Rails Event Store ecosystem. We use it in our customers’ projects with success since quite some time.

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! Apply!

One of the cornerstones of the Rails Event Store is keeping it 100% covered with tests. Rails Event Store can become an important part of the application. There’s no other way than keeping it well covered with tests. Mutant is the tool…

Missing brick

One of…

Depfu 

Gemfile's new clothes

The Bundler team currently works hard on pushing Bundler to the 2.0 release. This release will change a lot of default behavior, so it might be good to catch up with these changes way before the actual release. Some of the things that Bundler 2.0 will change are already possible with the latest releases, they’re just not default yet.

Probably one of the most visible changes is that Gemfile and Gemfile.lock will cease to exist. Well, under that name, at least. Enter gems.rb and gems.locked.

But why?

Let’s start with Gemfile. At the time when Bundler came out, the so called “Filefiles” were quite popular. There’s the Procfile introduced by Heroku and foreman, we all know Rakefile and of…

Greater Than Code 

045: Sexual Assault and Project Callisto with Lynn Cyrin

This episode is sponsored by Upside!

Bundle your flights and hotel. Save money. Earn gift cards.


Content/Trigger Warning: This episode discusses sexual assault.

Panelists:

Astrid Countee | Jamey Hampton | Coraline Ada Ehmke | Sam Livingston-Gray

Guest Starring:

Lynn Cyrin: @lynncyrin | lynncyrin.me

Show Notes:

00:16 – Welcome to “Fullstack Activism” …we mean, “Greater Than Code!”

01:22 – Lynn’s Background Story and Superpowers

FIRST LEGO League

11:34 Project Callisto: Reporting Sexual Assault and Dealing with The System

17:57 – Institutional Betrayal and Keeping Information Private

20:49 – The Chain of Command: How Project Callisto Works

22:17 – Reticence When it Comes to Talking About…

Search Results for “ruby” – via @codeship 

Overview of Functional Programming

Reading Time: 9 minutes

The developer community seems to be in the midst of a paradigm shift, moving away from object oriented programming (OOP) principles and toward functional programming (FP) principles. We’re at the beginning of this shift. I have seen a number of job postings out there saying they’d like FP experience but would accept someone who wanted to learn.

My intention in this blog series is to explain how to think about this shift by describing the main ways we will need to adapt. In subsequent posts, I will introduce you to a few of the significant FP tools that look to me to be the right horses to bet on, namely Phoenix and Elixir as an alternative to Ruby on Rails and Elm as…

Red Panthers 

Deploying Crystal app to production using Heroku

This article assumes that you have Crystal and Heroku CLI installed.

Create a sample application

Create a new application using

$ crystal init app sample-app

You should see the following on your terminal

$ crystal init app sample-app
      create  sample-app/.gitignore
      create  sample-app/.editorconfig
      create  sample-app/LICENSE
      create  sample-app/README.md
      create  sample-app/.travis.yml
      create  sample-app/shard.yml
      create  sample-app/src/sample-app.cr
      create  sample-app/src/sample-app/version.cr
      create  sample-app/spec/spec_helper.cr
      create  sample-app/spec/sample-app_spec.cr
Initialized empty Git repository in…
Martian Chronicles 

Size Limit: Make the Web lighter

Authors:Andy Barnov, Writer at Evil Martians. Formerly international TV correspondent, now teaches Ruby and Rails basics to beginners and Andrey Sitnik, PostCSS and Autoprefixer author, Lead Front-end Developer at Evil Martians

Keep your JavaScript dependencies and polyfills in check and find out what exactly makes your code bloat with Size Limit. To demonstrate, we will code a simple library together, and then shrink its browser bundle so that it takes 5 000 (yes, five thousand) times less space than initially.

The power of limitation

Let’s admit: node_modules is a blessing and a curse.

npm is the world’s largest software registry, listing more than 350 000 packages. This unrestricted…

Hi, we're Arkency 

Interview with Sergii Makagon about hanami-events, domain-driven design, remote work, blogging and more

You might not have heard about Sergii but he got my attention some time ago. Because, you see… In one year Sergii wrote about 40 articles on http://rubyblog.pro/ and I started to see them mentioned in various places.

Then I saw he started doing some open source work on Hanami::Events and that tipped the balance. For a long time I wanted to interview some Ruby developers and I decided to start with him as I met him personally before :)

Meet Sergii Makagon :)

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! Apply!
The Bike Shed 

122: Name That Smell

Derek and Sean discuss going from zero to code on new projects, writing tests that deal with external services, and a tricky floating point precision bug Sean encountered in ActiveRecord.

Drifting Ruby Screencasts 

Auditing with Paper Trail

Using the paper_trail gem, track changes to model records for auditing purposes and rollback changes when required.
Riding Rails 

This Week in Rails: engine screenshots, method redefinitions and more!

Oh, hello there! I’m Tim, and if you’re reading this that means you’ve got Rails fever! It’s time for your weekly dose of This Week in Rails….

This Week’s Contributors

This week 21 people contributed to Rails, including 4 for the first time! If you’d like to join them and perhaps get a slot in next week’s edition, why not check out the list of open issues?

Support multiple version arguments for gems in generators

The gem method can now support multiple version constraints, just like in rubygems!

Make take_failed_screenshot work within engine

This method used to get the tmp directory relative to Rails.root, which in an engine points to the dummy application, where no such directory…

Christoph Lupprich 

Change sidebar content for certain Rails controllers

Most (or even all) pages in your Rails application have the same sidebar content, but just one needs to show something different? On your login and registration pages, you don’t want to show the last five books/movies/events, but a marketing text why people should signup for your site? You’re currently using an if/elsif/else statement to switch content based on the controller’s name?

Time to learn about Rails’ Template Inheritance. Your application layout probably looks something like this right now:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# app/views/application.html.erb
<!DOCTYPE html>
<html>
  <head>
    <title>My Rails Application</title>
    <%=…
Valentino G's Blog 

An Introduction to Building TDD RESTful APIs with Koa 2, Mocha and Chai

Intrigued by Koa 2, I’ve started to play with it lately to build an API. And I liked it, especially when you start to see all those green marks after typing npm test.

Building something with Javascript is relatively easy. Take a look on Medium and you’ll see an uninterrupted stream of articles and tutorials.

But… how many of them covers Test Driven Development with Javascript? Few. Mine included. Testing is hard and more often than not I find myself writing code without even having a test case.

So, what follows is an introduction to building a RESTful API with Koa 2, Mocha and Chai, by following the TDD principles.

Koa 2, Mocha, and Chai

The concept is simple: we’ll build a simple API for displaying and storing…

RubyBlog.pro 

Ruby: pass by value or pass by reference?

When developers switch to a new language, that's one of the questions they try to figure out: does it pass arguments by value or by reference? Ruby has a quite interesting answer to that question so let's find out how it works.
Drivy Engineering 

Code simplicity - Command pattern

The command pattern is sometimes called a service object, an operation, an action, and probably more names that I’m not aware of. Whatever the name we gave it, the purpose of such a pattern is rather simple: take a business action and put it behind an object with a simple interface.

A controller’s action doing it all

One of the most common use case I encounter for this pattern is to get business logic out of MVC’s controllers. For instance, in a Rails application, an action responds to a single HTTP call using a POST, a PATCH, or a PUT verb and semantic. It means that those actions are intended to update the application’s state.

The following example takes an action to illustrate the…

Drivy Engineering 

Code simplicity - Reading levels

When we write code, who is it for? Is it for the machine? It is the machine that will parse and run your code. Is it for the next developer? It is that person that will spend time reading and updating the code. Is it for the business? After all, the code wouldn’t exist if it had no purpose. Obviously I think code targets all of them.

The goal is to not only make your code understandable by the machine, but also to your future self and to the business itself. This isn’t an easy thing. In this article I only aim to go past the machine-readable to reach the next developer level. To do that, let’s refactor a small fictive class…

Initial code

In the previous article of the serie, I started…

Devon C. Estes - Articles 

Insurance

I come from America. It’s a beautiful, but dangerous, place. We have all sorts of terrible natural disasters that can strike at any moment, and without warning. Hurricanes, tornadoes, earthquakes, wildfires, volcanoes, tsunamis, blizzards, avalanches, killer meteors - Nature seems to really have it out for us!

Red Panthers 

How we made our rspec test suite to run 2x faster

 

Why on earth is my test suite taking so long to run?

If you are a developer, you might have asked this question at least once to yourself. So did we, our rails project’s test suite was taking a good 1 hour 30 minutes to run and we wanted to improve that time so badly that we eventually did exactly that, reducing nearly 1 and half hours to just minutes, and this is how we did it.

1. Database independent tests

DB operations are often time-consuming and most of the time we can do away with saving objects to the database to run our tests.

Use test doubles, stubs and mocks instead of creating the real instance of a class and invoking methods on the created instance.

class Student <…
Ruby Weekly 

#364: Multiple Vulnerabilities in RubyGems

This week's Ruby and Rails news
Read this e-mail on the Web Ruby Weekly Issue 364 — August 31, 2017
Brandur Leach
How heap and object allocation work in Ruby, often leading to bloated sub-processes, and what’s on the roadmap to help.


ruby-lang.org
It’s time to run gem update --system and get up to RubyGems 2.6.13 as there’s a DoS vulnerability, a DNS request vulnerability, and others.


Alex Wood
The stable version 3 of the AWS SDK for Ruby is now out with a new modular approach. I’ve found loading the AWS…
Red Panthers 

Concurrent-Ruby

Concurrent Ruby

Concurrent-ruby is a gem that was brought my attention during Anil Wadghule’s talk in RubyConf India 2017.

Concurrency is the ability of a program to make progress on a task that is spread out over different slices of time. It allows us to run multiple “threads” at the same time. As one thread may be sleeping or waiting on I/O, another thread may take priority and start working, thus making optimal use of available CPU time. When you think of concurrency, think of “threads”.

Modern concurrency tools include agents, futures, promises, thread pools actors, supervisors etc.Concurrent Ruby makes the strongest thread safety guarantees of any Ruby concurrency library. Every abstraction in this…

All Ruby Podcasts by Devchat.tv 

MRS 018 My Ruby Story Kinsey Ann Durham

MRS 018: Kinsey Ann Durham

Today's episode is a My Ruby Story with Kinsey Ann Durham. She is one of the speakers for the Ruby Dev Summit. Listen to learn more about Kinsey!

[01:15] – Introduction to Kinsey Ann Durham

Kinsey was on episode 180 of the Ruby Rogues podcast. They talked about Barriers to New Developers. It’s been 3 years. She is also one of the speakers for the Ruby Dev Summit, which is coming up in October.

[02:55] – How did you get into programming?

RailsBridge workshop

Kinsey got into programming, not through the traditional Computer Science route or boot camp / code school route. She actually did a RailsBridge workshop 4 or 5 years ago in Denver. RailsBridge is part of…

Ruby Inside - Medium 

Everything in its Right Place: Keeping Your Specs Up With the Times

https://cdn.pixabay.com/photo/2015/10/04/11/33/matryoshka-970943_960_720.jpg

Tests are inseparable from the Ruby community: the vast majority of Rubyists — 94%, to be accurate — incorporate tests in their work. Great stats, yet they do not mean zero problems. One such problem, more prone to appear on large scale projects, is outdated specs. By ‘outdated’ I mean specs that aim to describe the doings of some class, yet the described behavior no longer derives from that class; alternatively, the described behavior was extended or changed. In this post I will try to tackle this elusive problem using some of RSpec’s basic-yet-strong features.

Code moves around. In well-maintained projects, it’s…

Hi, we're Arkency 

DATABASE_URL examples for Rails DB connection strings

Recently I’ve been configuring RailsEventStore to run tests on many databases on the Travis CI. We do it using DATABASE_URL environment variable but I couldn’t find good examples easily. So here they are.

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! Apply!

PostgreSQL

DATABASE_URL=postgres://localhost/rails_event_store_active_record?pool=5

MySQL

DATABASE_URL=mysql2://root:@127.0.0.1/rails_event_store_active_record?pool=5

Sqlite in memory

DATABASE_URL=sqlite3::memory:

Code

ENV['DATABASE_URL'] ||=…
Drifting Ruby 

A Tail of Debugging Issues

There have been many times when I’ve been debugging a complicated issue. More often than not, it was something crazy that I had done and it seemed like a good idea at the time. Whether it is a endless recursive loop or just a good ole bug in the code.

We all have our own ways of debugging and sometimes they’re really efficient. However, other times, they’re just familiar so that is our first weapon of choice. Just because something is familiar does not make it efficient. Sometimes branching out and trying something new may not be efficient due to the initial learning curve.

However, this article will take two most likely familiar techniques and combine them into one simple, rememberable and…

Ruby Inside - Medium 

Writing a Ruby Library in Crystal

The Crystal Programming Language is one of the bleeding edge programming languages around the block. Its main attractive features are the following:

I was sold because it has Ruby style syntax and you can compile it to a single binary to run anywhere similar to Go. Imagine you don’t need to install rvm, chruby or Gems, you simply compile the binary for your architecture and stick it on a server (or Docker container) and it just works. This was my main motivation for writing an Elasticsearch library in Crystal.

After spending 4 months rewriting the Elasticsearch Ruby (https://github.com/elas…

Riding Rails 

Webpacker 3.0: No separate process needed, less config generated

We’ve just made it even easier to use Webpack with Rails with this third major release of Webpacker. The two big changes are that a separate process is no longer needed in development and that the vast majority of the config now lives in the Webpacker npm package, so your config/ directory stays clean and updates are much easier.

We nixed the need for the separate process by allowing Webpacker to compile on-demand in development as well as testing. We’ve done a lot of work to speed up this process, and for lots of apps, the performance will be more than fine. But if you have a huge app, or if you like live reloading or hot module replacements, you can still use the bin/webpacker-dev-server

ruby – Bibliographic Wilderness 

Gem dependency use among Sufia/Hyrax apps

I have a little side project that uses the GitHub API (and a little bit of rubygems API) to analyze what gem dependencies and versions (from among a list of ‘interesting’ ones) are being used in a list of open Github repos with `Gemfile.lock`s, that I wrote out of curiosity regarding sufia/hyrax apps. I think it could turn into a useful tool for any ruby open source community using common dependencies to use to see what the community is up to.

It’s far from done, it just generates an ASCII report, and is missing many features I’d like. There are things I’m curious about that it doesn’t report on yet, like history of dependency use, how often do people upgrade a given dependency. And I’d…

Ruby – AWS Developer Blog 

Announcing the Modularized AWS SDK for Ruby (Version 3)

We’re excited to announce today’s stable release of version 3 of the AWS SDK for Ruby. The SDK is now available with over 100 service-specific gems (starting with aws-sdk-*, such as aws-sdk-s3) on RubyGems. You can find a full list of available service gems can be found at our GitHub landing page.

Features

Version 3 of the AWS SDK for Ruby modularizes the monolithic SDK into service-specific gems, for example, aws-sdk-s3 and aws-sdk-dynamodb. Now each service gem uses strict semantic versioning, along with the benefits of continuous delivery of AWS API updates. With modularization, you can pick and choose which service gems your application or library requires, and update service gems…

These new…

Schneems - Programming Practices, Performance, and Pedantry 

How I lost 17,000 GitHub Auth Tokens in One Night

How on earth does someone accidentally delete 85% of their users’ GitHub tokens? I was suspicious that something might be wrong when I got an email from a service I run called CodeTriage, it’s a free web app to help find open source projects and issues to work on. While I get plenty of emails from my service, I don’t often get ones with the subject line “Code Triage auth failure”. Before we can understand what happened, let’s look into why this email even exists.

Hi, we're Arkency 

Why we follow the Rails repo structure in Rails Event Store

A complete Rails Event Store solution consists of following gems:

  • ruby_event_store — core concepts and and mechanics of an event store
  • rails_event_store — thin wrapper over ruby_event_store with additions possible in Rails framework (like automatically capturing some of the request params into event metadata) and necessary glue to make it work out of the box
  • rails_event_store_active_record — a database adapter based on ActiveRecord
  • aggregate_root — library useful for making event-sourced aggregates

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! App…
Search Results for “ruby” – via @codeship 

The Benefits of Continuous Integration in the Cloud

Reading Time: 7 minutes

There are a large number of technologies and concepts that can dramatically improve software quality, while simultaneously reducing its development time, cost, and effort. The question, though, is which combination is the right one for both your organization and your project?

Like so many topics, the answer to this one is, “It depends.” So today, I’m going to help whittle that list down somewhat by looking at several of the main advantages that continuous integration (CI) in the cloud can bring. However, before I do that, let’s quickly recap what CI and the cloud are, starting with the cloud.


“Which combination of tools and services is right for your CI solution?”…

Red Panthers 

Integrating Elm with Rails

 

Front-end languages and frameworks are changing significantly over years. The trend is towards light-weight, modular architecture. Functional programming have influenced JavaScript and its frameworks a lot. For beautiful single page web applications, Elm is a framework that can be chosen. It  gets compiled to efficient JavaScript code. But when to use Elm instead of JavaScript?  If you are building complicated single page applications Elm can do better.

Elm is a functional programming language created by Evan Czaplicki in 2012 for building reliable Web Applications. Elm is simple to use and offers much quality. Its architecture is a simple pattern for building webapps, that help you to…

The Life of a Radar 

Rails, Dropzone.js, Amazon S3 and imgix

In this tutorial I'll cover how you can upload files directly to S3 by using a feature called PresignedPost. I'll then show how you can use imgix to resize these images dynamically after they've been uploaded.

The Rails app that I use for this tutorial is dropzone-example, with the finished branch being the final version of the code from this tutorial.

Background

I've got a small hobby Rails app that I use to share photos with my extended family. This app had humble beginnings: it was a very light Rails application with one model that used Paperclip to handle the attachments. Paperclip works very well, and I especially love that I don't have to care about how my photos get resized;…

Search Results for “ruby” – Journeys of a young Software Engineer 

Careful what you measure: 2.1 times slower to 4.2 times faster – MJIT versus TruffleRuby

Have you seen the MJIT benchmark results? Amazing, aren’t they? MJIT basically blows the other implementations out of the water! What were they doing all these years? That’s it, we’re done here right? Well, not so fast as you can infer from the title. But before we can get to what I take issue with […]
ruby – Bibliographic Wilderness 

full-res pan-and-zoom JS viewer on a sufia/hyrax app

Our Digital Collections web app  is written using the samvera/hydra stack, and is currently based on sufia 7.3.

The repository currently has around 10,000 TIFF scanned page and photographic images. They are stored (for better or worse) as TIFFs with no compression, and can be 100MB and up, each. (Typically around 7500 × 4900 pixels). It’s a core use case for us that viewers be able to pan-and-zoom on the full-res images in the browser. OpenSeadragon is the premiere open source solution to this, although some samvera/hydra stack apps use other JS projects that wrap OpenSeadragon with more UI/UX, like UniversalViewer.   All of our software is deployed on AWS EC2 instances.

OpenSeadragon works…

Hi, we're Arkency 

inject vs each_with_object

Recently I’ve been adding new exercises to DevMemo.io and some of them were about Enumerable#inject (also available as aliased method reduce) and some of them were about Enumberable#each_with_object. And I’ve been thinking about a small guideline for when to use which.

Looking for a RoR job? How about working in a flat-structured, employee-owned web dev company in Kraków, Poland? We’re looking for smart, open-minded people. Join the u2i team! Apply!

inject

  • better for operations on mutable objects/collections which return a new value
  • good for immutable primitives and value objects which return a new value when changed

each_with_object

  • bet…
Ruby – Sihui Huang 

Combining has_many :through with polymorphic associations in ActiveRecord

You read the Rails guide and thought you have understood the has_many :through association and polymorphic associations. Your app models needed both. Unfortunately, the guide didn’t explain how to combine these two together.  Wondering why on earth the guide would leave out the most important yet complicated part, you had no choice but try to put them together yourself hoping you would get it right.

Your has_many :through associations seemed right. Your polymorphic associations also seemed identical to the examples in the guide. But ActiveRecord kept throwing errors: Could not find the association :foo in model Bar, Cannot have a has_many :through association ‘Bar#foos’ on the polymorphic…

OmbuLabs Blog 

Upgrade Rails from 2.3 to 3.0

This article is the first of our Upgrade Rails series. We will be covering the most important aspects that you need to know to update your Ruby on Rails application from version 2.3 to 3.0.

  1. Considerations
  2. Ruby version
  3. Tools
  4. XSS protection
  5. Config files
  6. Gems
  7. Deprecations
    • Active Record
    • Action Mailer
    • Metal
    • Railties
  8. Next steps

1. Considerations

Before beginning with the upgrade process, we recommend that each version of your Rails app has the latest patch version before moving to the next major/minor version. For example, in order to follow this article, your Rails version should be at 2.3.18 before updating to Rails 3.0.20

2. Ruby version

Rails 3.0 requires Ruby 1.8.7 or higher, but…

Ruby News 

Multiple vulnerabilities in RubyGems

There are multiple vulnerabilities in RubyGems bundled by Ruby. It is reported at the official blog of RubyGems.

Details

The following vulnerabilities have been reported.

  • a DNS request hijacking vulnerability. (CVE-2017-0902)
  • an ANSI escape sequence vulnerability. (CVE-2017-0899)
  • a DoS vulnerability in the query command. (CVE-2017-0900)
  • a vulnerability in the gem installer that allowed a malicious gem to overwrite arbitrary files. (CVE-2017-0901)

It is strongly recommended for Ruby users to upgrade or take one of the following workarounds as soon as possible.

Affected Versions

  • Ruby 2.2 series: 2.2.7 and earlier
  • Ruby 2.3 series: 2.3.4 and earlier
  • Ruby 2.4 series: 2.4.1…

Workarounds

If you…

All Ruby Podcasts by Devchat.tv 

RR 325: Date Night with Ruby with Ruberto Paulo

Tweet this Episode

RR 325 Date Night with Ruby with Ruberto Paulo

In this episode, panelists Dave Kimura, Eric Berry, and Charles Max Wood discuss ongoing learning and keeping your passion for programming alive with Ruberto Paulo.

[01:16] Ruberto Paulo introduction and discussion on the South African and worldwide Ruby scene

Rubyist from Cape Town, South Africa. Works for a fintech company in Cape Town. He's an organizer of RubyFuza and Ruby DCamp in South Africa.

The Ruby scene in South Africa is growing as is fintech. His company's platform was build by Platform45 and is now maintained by his employer.

Developers are also finding work in the wider world from the Cape Town area.

Is…

Red Panthers 

The future of Spree OSS and whats new in Spree 3.3

The story so far

Ever since its advent in 2007, Spree – originally developed by Sean Schofield, is the most popular open source Ruby On Rails E-commerce Software spanning over 17,703 commits, 725 contributes and 208 releases. Spree was acquired by First Data in the late 2015 and since then, there has been fair amount of speculation around Spree remaining as an opensource project and it’s long term future as outlined here in this blog post.

As it turned out Spree didn’t die off, but revived under a new core team. After the acquisition announcement developers from Spark Solutions and Vinsol volunteered to keep spree alive and has been doing a fantastic job, putting shoulders to the wheel by…

nasseri.io RSS Feed 

The Structure and Interpretation of Ruby Programs

Understanding how ruby programs are tokenized, parsed, and compiled.
Test Double | Our Thinking 

The business case for modern engineering practices.

From a developer's perspective, modern engineering practices have a lot of advantages. You can spend less time debugging when you have a suite of automated unit tests to pinpoint problems. Most developers I've met who've made the switch from conventional coding practices to modern engineering practices have had an almost religious experience with how much it has helped them technically, professionally and even personally.

But that's not the topic for today. Today's topic is why modern engineering practices make business sense. Why are they worth investing in? Why will they benefit the organization?

Working at Pillar Technology the past eight years, I've had the chance to see several dozen…

Riding Rails 

Image alt text gone, restart/cache command fixes and more!

Hello everyone!
This is Vipul from Rainy Pune ☔ , cozying up with a ☕, bringing you a recap of the changes  that made it to Rails this week.
If you too want to contribute to Rails, head over to the issues to help us out!

Do not generate default alt text in image tags

Previously Rails auto-generated alt text for an image from the file name if it was not provided with an image_tag. This generation could be distracting and fatiguing for screen reader users if not considered properly.

After this change, if authors leave images without alt text, Rails will not pre fill it anymore, leaving screen readers to prompt authors to fix the issue.

Prevent extra “SET time zone” in…

BigBinary Blog 

Uploading file in an isomorphic ReactJS app

Design of an isomorphic App

In a typical single-page application (SPA) server sends JSON data. Browser receives that JSON data and builds HTML.

In an isomorphic app, the server sends a fully-formed HTML to the browser. This is typically done for SEO, performance and code maintainability.

In an isomorphic app the browser does not directly deal with the API server. This is because the API server will render JSON data and browser needs to have fully formed HTML. To solve this problem a “proxy server” is introduced in between the browser and the API server.

Architecture

In this case the proxy server is powered by Node.js.

Uploading a file in an isomorphic app

Recently, while working on an isomorphic…

Appfolio Engineering 

Rails and Discourse Startup Times

I've spent a lot of time benchmarking how fast Discourse handles HTTP requests with various Ruby versions, to see how much new Ruby fixes help Rails speed. But I haven't looked yet at startup time, which can be very important for Rails apps. Specifically, I'm looking at time to handle first request. It's not the only definition of "startup time," but I think it's a very useful one.

Using a "real world" benchmark with Discourse, a production Rails app, makes for a few challenges. Specifically, Ruby, Rails and Discourse are all independently changing. It's not a synthetic benchmark app, it's a real app with a real user base and it only works with certain specific Ruby versions (and a single…

AkitaOnRails.com 

[Off-Topic] Blockchain e Criptomoedas no Brasil

Para quem me acompanha no Twitter viu que ando MUITO interessado e ativo com cryptocurrencies atualmente. Ainda estou somente como investidor, sem nenhum projeto em si.

Então, de curiosidade perguntei no Twitter se alguém conhecia empresas ou pessoas atuando nessa área aqui no Brasil e achei a lista muito interessante. Então quero compartilhar com todo mundo as recomendações que recebi.

  • Auctus - ICO de uma alt-coin
  • Original My - proof-of-authenticity
  • Laivon - parece que desenvolve apps mobile e alguns deles são trackers de cryptocurrencies
  • OpenDime - mais um hardware stick pra wallet - dizem que tem brasileiros trabalhando lá também
  • HugPay - uma forma de fazer remessas de/para o exterior…