The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Pluck deeply into nested associations
pluck is great when you simply want the attributes without the need of model construction. But if you want to pluck associated models’ attributes, you unfortunately can’t. deep_pluck allow you to pluck deeply into nested associations without loading a bunch of records. And DRY up your code when using #as_json.
From Rails to Hanami: Controllers
The second article of a series comparing Rails and Hanami, in which we will build a ToDo app showing the Rails version of the code, and how to achieve the same in Hanami. https://blog.codeminer42.com/from-rails-to-hanami-controllers-ad7ef6d09dd0
How to Use Ruby and Watir to Scrape The Web?
Have you ever had the problem that some services miss an API integration and you need to click through a page manually? Or you wanted to automate a process? Here comes Watir, an open source Ruby library build for automated tests. Learn more here: https://www.nopio.com/blog/web-scraping-with-watir/
[Screencast] Pagination with Kaminari
When displaying a significant number of records, it is often a basic functions in a web application is to paginate the records and load them as requested. https://www.driftingruby.com/episodes/pagination-with-kaminari
Tutorial: Uploading files in your Rails application
Uploading files into your Rails application has never been easier, and with the a wealth of useful gems around to help there’s no better time to be working with files.In this tutorial, I’m going to run through uploading an image. https://atech.blog/atech/file-attachments-in-rails-tutorial
Why using constant mocking in RSpec is a bad idea?
This blog post explains why you should never write expect(Noo).to receive(:doo).and_return(bar) [more inside]
tty-editor v0.2.0
The latest tty-editor provides revised #open api that allows to distinguish between file and text content opening. It also adds support for Windows. Enjoy and happy hacking!
How to change the default new line delimiter in Ruby
One of the core pillars of motivation is having the opportunity to use some form of autonomy at the work that you do. Ruby programming language allows you to do just that with a lot of its built-in features. It gives you the ability to override methods of basic built-in classes, methods and also attributes. One such attribute in which we will focus on this article is the ability to change the default new line delimiter. http://www.fatosmorina.com/change-default-new-line-delimiter-ruby/
TheOpenCMS. Weekly report #3
Hi there! There is a weekly report about my progress on my CMS project Changelog vol. 3
Testing Jekyll Websites with Capybara
Do you have tests for your Jekyll website? If not, it’s pretty straightforward to test your Jekyll website using Capybara. http://phansch.net/2017/03/13/testing-jekyll-websites/
Thredded v0.11.0: Onebox support and more
Thredded, the best Rails forum engine, has just released v0.11.0. Major new features include onebox support, and the ability to automatically follow all new topics. See the release notes at https://github.com/thredded/thredded/releases
Decoupling from Rails [Part 1] - Repository and UseCase
This article will show how to decouple business logic from Rails-specific code. http://rubyblog.pro/2017/03/decoupling-from-rails-repository-and-use-case
[Brasilian] Pratical Guide: Spaceship-operator
Take a look at : https://merubygirl.wordpress.com/2017/03/22/spaceship-operator/ , a programming blog for people that already code, wanting to learn Ruby.
When you notice something strange in your benchmarks
Remember there are two layers of your code - Ruby code that you wrote and Ruby’s C engine. Here’s a story of unusual benchmark results that lead to changing Ruby’s internals.
Gem elixirize now out!
Add Elixir’s pipe behavior to Ruby with the ᐅ method. https://github.com/danielpclark/elixirize
Using [array].include? often, did you consider Set?
Writing [array].include? often? Do you know that in many cases Set[array].include? might be faster because it offers a constant look up time when array look up is linear - grows with the size of the array. Check out a simple benchmark results. And compare it to Java (if you’re interested)!
Best Books to Learn Ruby on Rails - intermediate level
We’re back with the ‘Best Books to Learn Ruby on Rails’ series! This time: RoR books for those with some experience in their background.
Why I Stay Behind The Version Rat Race
What are the risks associated with being on the latest gem versions? Should you allow auto-updates to dictate when your software versions get bumped? [more inside]
With pattern in Rails
A little pattern I have been using lately, inspired from Ember.
Refactoring Ruby: From Subclass to Registry
From developing a solution to gradually improving it by listening to the pain [more inside]
Create a landing page with Sinatra, Google Spreadsheets, and Ruby
A practical example of using Google Spreadsheets as a datastore for a tiny app that take user details. Build a landing page with Sinatra and Google Sheets.
KMS Models v0.8.0 release
This KMS Models release adds feature allowing to create Model’s elements outside of admin section, i.e. via forms on website.
Ruby 2.4.1 Released
Ruby 2.4.1 has been released. Along with the usual tweaks, Onigmo has been updated (and now supports a new operator), OpenSSL (2.0.2 to 2.0.3), RubyGems (2.6.8 to 2.6.10), a race between read and close has been fixed, fixing including multiple proc blocks as literal hash values, and a lot more besides.