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.
Today
How I Do Rails Controllers
In light of DHH’s current insights on how to structure Rails controllers, I’d like to share how I typically handle controllers in a Rails application. (tl;dr I use CanCanCan and Responders to keep my controllers lean and boring.)
Ruby's Scaffolding Tool for New Projects (Gems, Sinatra, etc.) e.g. $ quik new gem
Hello, I’ve moved all quik project templates and scripts to a new github org, that is, quikstart. What’s quik? quik is a ruby quick starter template script wizard .:. the missing code generator. Try: [more inside]
Simple gem for writing conditionals with dates and time
https://github.com/Szeliga/time-predicates - when debugging legacy code or introducing myself to a new codebase, I always have struggled with figuring out which date is in the future and when the condition is going to be fulfilled. So I wrote this gem to provide easy to read predicates for Date and Time objects.
Compass Gem Basics
Write a Hello SASS program to learn the basics of SASS.
Does Rails everything for us?
The latest Rails security fixes were another reminder that we shouldn’t rely too much on a framework to solve everything security for us. Let’s take a moment every time we use user input directly (like in render params[:id]) and think about what class it could potentially be: Fixnum, String, Array, Hash, nil, a blank string. This and other news in the Rails and web app security reading list.
Stronger Parameters Gem
Discovered this today - a gem to help with type-checking submitted Rails params: https://developer.zendesk.com/blog/introducing-stronger-parameters
Rails 5 adds http_cache_forever to allow caching of response forever
Rails 5 allows to cache HTTP responses forever by introducting http_cache_forever method. [more inside]
ActiveRecord is reinventing Sequel
I’ve been happily using Sequel for over a year now, and was finding it to be consistently better than ActiveRecord. Moreover, I found out that most of new ActiveRecord’s features were already part of Sequel for quite some time. I think that’s a big and controversial discovery, so I decided to write a post where I attempt to prove my claims.
Avoid race conditions with record locking
Especially useful with high volume applications, record locking helps to maintain data integrity and avoid race conditions. [MORE INSIDE]
Experimenting with database indexes - How fast can it get?
In this blog post I’m explaining what database indexes actually are and how much they can improve your query times in a Ruby on Rails application that contains a lot of records. The tests are done on a Postgresql database. [more inside]
Upgrade Legacy Passwords to Use Devise
Sometimes you get an old app that has a garbage password encryption scheme. Find out how to seamlessly update it to secure your app and prevent a security event.
Stay Static - Jekyll vs Middleman - And the Winner is...
Hello, For tonight’s Vienna.rb meetup I’ve put together a talk titled “Stay Static - Jekyll vs Middleman - Build Static (Web) Sites w/ Ruby”. The agenda reads: [more inside]
Three techniques to make your code for readable
Readable code is maintainable code. This article discusses best practices for writing readable code.
Better exception responses in Rails 5 API apps
Rails 5 has introduced better exception response format for API only apps. The post http://blog.bigbinary.com/2016/03/03/better-exception-responses-in-rails-5-api-apps.html discusses new configuration provided in Rails 5.
Code Ruby like you build Lego (refactored)
This illustrates a way to chain functions and service objects in Ruby if ever you miss the | (pipe) operator from unix and/or Elixir. I changed the presentation after the feedback from different talks: http://slides.com/apneadiving/code-ruby-like-you-build-lego [more inside]
Generating Sprite Images using Compass Rails Gem
Learn how to Create Sprite Images using Compass Rails Gem in Rails 4.2.5 to speed up your Rails 4.2.5 Apps.
View, Add, Remove & Modify Metadata Details of Documents & Image Files within .NET Ap
We are happy to release the new version of GroupDocs.Metadata for .NET. It supports working with metadata associated with various document and image formats. The API facilitates the user with simple syntax, easy to use methods and few lines of code to perform metadata operations. It provides the support of many popular document and image formats and the number is going to increase in next release. Metadata is structured information that is used to contain important business information of different resources. Having the ability to filter through that metadata makes it much easier for someone to locate a specific resource. Keeping the eyes on the importance of metadata, GroupDocs team thought to make an API that will help users to deal with metadata in an easy manner. GroupDocs.Metadata API is developed to empower developers and make their life easier while working with metadata. It is a very powerful and easy to use API that provides all basic metadata operation (i-e view, add, modify, remove) for a number of file formats. API gets the file as an input and makes its metadata accessible for the user. Now, it is up to the user to perform any of his desired operations on this metadata. Read more: http://goo.gl/mlz5dy
ThreadPool: a Ruby antihero
Threading gets a bad wrap in Ruby - even still, you may be using thread pools everyday without even knowing it. Many of the most popular ruby gems use the concept of “pooling” to manage expensive resources. In this post, we’ll examine why thread pools are useful and take a test-driven approach to implementing one ourselves. https://rossta.net/blog/a-ruby-antihero-thread-pool.html
Reality: access to real-world entities
New reality gem provides access (through Wikipedia and Wikidata and other services) to real-life data. Its goal is to make entire world computable.
kramdown - markdown converter - update - v1.10 - released (now incl. strikethrough)
Hello, Via Vienna.html great news - kramdown v1.10 is out - thanks to Thomas Leitner - the author (from Vienna, Austria ;-) of the markdown converter in ruby. What’s news? [more inside]
Unicode Character Widths
Q: How do you determine how many terminal columns a string will take? A: It is not possible, because it is not standardized for every character! But you can achieve good results with EastAsianWidth.txt, Unicode’s general categories and other data. [more inside]