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.
Infoboxer: use Wikipedia as datasource
An infoboxer gem is a huge effort to allow automated information extraction from Wikipedia and other MediaWiki sources. Here is a blog-post, explaining how and why.
HasDefaultAssociation
Setting default values in ActiveRecord is a bit tricky, default associated records, trickier still. See how HasDefaultAssociation manipulates ActiveRecord associations to provide easy defaults. You’ll learn about Rails and touch of metaprogramming as well.
Safer SQL: Using ActiveRecord Transactions
As your application grows, how do you make your application defensive and write safe code? ActiveRecord transactions are one way to write safer SQL statements. This blog post examines the transaction method under the hood, and highlights the golden rules of transacting.
Curated list of Ruby libs for web-scraping and data-processing
I build a list of web scraping and data processing libs for a number of languages. At the moment I have lists for ruby, python and PHP. The list for ruby: https://github.com/lorien/awesome-web-scraping/blob/master/ruby.md
Tips for participating in the rails rumble
The Rails Rumble is the biggest international Rails hackathon and it’s organized once a year - over 100 teams distributed across the globe, each with 4 members fabricating an awesome Rails app in 48 hours. The next one is on the 7th and 8th of November and here’s some tips on how to prepare your team!
Magic Numbers in Ruby & How You Make Them Disappear
Magic numbers sound exciting. Maintaining code that uses them is not. Learn from real world Rails projects to see how experienced developers use clarifying constants to avoid magic numbers in their work: https://eliotsykes.com/magic-numbers
How To Set Up A Rails Application On Main Domain With Passenger?
Here are the steps to set up a Rails Application on Main Domain with Passenger : 1. Upload your application to the server using either ftp/sftp or SSH or if you have your application under version control, checkout or clone your application to a folder in your home directory. To read full article, visit RailsCarma Blog .
Gems != Magic
Ruby gems can seem magical. Usually, one (or more accurately: thirty) solution to a problem exists in the form of a gem. Using gems is easy and intuitive. Simply add a line in the project root’s Gemfile and run bundle install. Then, either require the name of the gem or, if using Ruby on Rails, start using the gem’s code immediately anywhere in the project. It is important to understand that gems are tools, not magic.
Gr8 - a great CUI command for Rubyist
Gr8 brings Ruby power (such as map, select, inject, grep, sort, max, …) into command-line. See https://kwatch.github.io/gr8/ for details and examples.
Reconstructing Payloads With Lua
Further exploration on maximizing cache performance for Ruby apps. See how Lua can dramatically speed up API response construction: http://sorentwo.com/2015/08/17/reconstructing-payloads-with-lua.html
Automating the commandline using ruby
Learn about how you can automate the commandline using Greenletters in this post
Three most telling files in legacy Rails apps
In this blog post, I want to show you three simple techniques we use to get ourselves a solid starting point for working with legacy Rails apps. You will be able to apply it to projects you’re working on and improve your planning and refactoring thanks to it.
Eliminating Roundtrips with Preconnect
The preconnect HTML hint allows the application to tell the browser which sockets it will need ahead of initiating the actual requests; preconnect eliminates DNS, TCP, and TLS roundtrips from the request’s critical path.
Null Object pattern in practice
I wrote about eliminating if-statements by making a special case object with the same interface as the normal situation. You can read about in Null Object pattern in practice
Clean Ruby with cleaner privates (DCI)
Understanding the context of code in a team repo is hard and it’s harder when the solution to figuring how code works is, “I Don’t Know, just Git Blame and talk to the person who wrote it.” That works until the person to blame is either yourself or unavailable. [more inside]
Encapsulating Business Transactions With Transflow
A short introduction to a new gem I wrote: Encapsulating Business Transactions With Transflow
What the hash?
Recently I came across a piece of ruby code that got me a bit puzzled, so I explored the edge cases of Hash.new method. http://dabrorius.github.io/2015/08/what-the-hash.html
Polymorphic Associations With Active Record
Active Record Associations are one of the most important features of Rails. Polymorphic association is part of these associations. With polymorphic association, a model can belong to more than one other model, on a single association. Why do we need associations between models? To read full article visit, RailsCarma Blog
Paypal Express Checkout
I have upgraded railscast source code for Paypal Express Checkout using Ruby 2.2.2, Rails 4.2.3 and ActiveMerchant 1.52.0, here is the source code: https://bitbucket.org/bparanj/paypalexpress
Battling with the 'Known Unknowns' to keep inline with SRP
One never gets tired of some grandiose considerations on the fundamental principle of OOP. Here’s the 1st part of an article on SRP the Second part being closely related to an article that has been submitted here today about Interactors… There’s no coïncidences :-)
Redirecting HTTP requests using the IP address of a client in your Apache Config
Maybe you’ve got some Ruby or even Rails webservice running for different clients. Given that you need to serve some different resources to different customers under the same URL, redirecting requests based on IP address ranges can by quite handy. Read this article to find out how you can do that with Apache 2.4.
Introducing Interactors to represent getting stuff done.
This post introduces interactors, also know as usecases or service objects. See how your domain code can be separated from your framework. http://insights.workshop14.io/2015/08/16/introducing-interactors-to-represent-getting-stuff-done.html
mrh/mrhyde - static site quick starter script wizard - jekyll command tool
Hello, I’ve put together the mrhyde-tools gem that includes a command line tool that lets you run static site quick starter wizard scripts. For example, use $ mrhyde new starter or $ mrh n starter to download and install (unzip/unpack) a theme archive and configure a static site ready-to-use. For more quick starter wizard scripts see the Mr. Hyde’s Scripts library. For more themes see the Dr. Jekyll’s Themes directory. Cheers.
Faster TDD in Rails with Bundler's 'require: false'
This post explains why the Rails default behaviour of requiring all your gems automatically will lead to a slow TDD feedback cycle. Learn how to speed this up by avoiding loading gems unnecessarily, and also why using Spring may not be a good approach. [more inside]