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.
Filter sensitive Rails redirects in log files
Do you know the Rails.application.config.filter_redirect filter? It’s an undocumented configuration feature which lets you filter certain redirect URLs from your log files. This is handy when you’re redirecting to a URL with tokens in it so that they don’t show up in the log. Here’s an example.
Model's validation testing with type of validation
I have seen many times people do validation testing by comparing validation message, but instead if we use validation type ( symbolized key of locale ) to know which validation failed, it will make code easy and readable. http://blog.railsupgrade.com/2016/05/how-to-test-model-validations-with.html
SingleCov: Actionable code coverage
Singleov shows uncovered lines after each test run with minimal runtime overhead.
Ruby's Parameters Reflection
The last two days’ episodes: Fancy number literals and reflecting on method parameters!
Cache expiration by custom fields
I recently worked on the performance issue, which was solved by caching of complex response which consists of fields from several objects and I will describe below example of the solution which I came to. http://warolv.net/blog/2016/05/06/cache-expiration-by-custom-fields
Invisible Captcha: new release with time-sensitive form submissions
I just pushed a new release of Invisible Captcha (v0.9.0) with some interesting additions like: time-sensitive form submission (configurable per app, per controller and per action) and i18n integration. Also, we introduced a much better CI platform, to ensure compatibility across different Rails versions, and made a little clean up deprecating some useless things. [more inside]
Methods in Ruby
Check out this new post on the “Zen Ruby” blog: Methods in Ruby.
Matz on The Changelog
This week on The Changelog we caught up with Matz to discuss the origins of the Ruby programming language, its history and future, Ruby 3.0, Concurrency and Parallelism, Streem, Erlang, Elixir, and more. Listen Here.
Ruby Podcast Episode 4
Learn about the basic software development laws such as Linus’s Law, Occam’s Razor, Hanlon’s Razor, The Pareto Principle, Postel’s Law, Hofstadter’s Law and The 90-90 Rule. Listen to RubyPlus Ruby Podcast 4 .
Rails 5.0.0.racecar1 as been released today
It started as a joke, but adding “gem ‘rails’, ~> ‘5.0.0.racecar1’” to your gemfile will work. The RC1 of the framework was released today. It has been named in honor of DHH that could not attend RailsConf this year because of a race condition. [more inside]
Use hashids in ActiveRecord to obfuscate ID
I made a gem which provides the functionality to use Hashids in your Rails application transparently. https://github.com/dtaniwaki/acts_as_hashids Please take a look and give me a feedback in GitHub.
Free Online Full-Day Jekyll Static Site Conference 10am-5pm (PST) Sat May 7th
Hello, Just a reminder: Tomorrow (Saturday) at 10am Pacific U.S. West Coast (e.g. San Francisco) Time starts the free single-track full-day online Jekyll static site builder conference aka JekyllConf. 12+ talks about all things Jekyll and friends. PS: For more static sites news bytes (Jekyll, Middleman, and friends) see the Static Times twitter news channel @statictimes. For more Jekyll goodies, see the Awesome Jekyll series @ Planet Jekyll ;-) Cheers.
A Wishlist for Ruby 3.0's New Typing System
Ruby 3.0 may include static typing! We shouldn’t be too afraid. [more inside]
Active window time logger (Linux)
Time Management Tool. I’ve written a Ruby gem that grabs the current active window name every 15 seconds and catalogs the time. Help keep track of productive/unproductive time. As I consider this a very helpful tool I felt this would be appropriate to share. See the gem clock_window.
Purify your programs with capability objects
Introduction to capability objects. Also a discussion of how to use these to improve the effective purity of functions. All with the aim to improve modularity in your programs. http://insights.workshop14.io/2016/05/01/purify-your-programs-with-capability-objects.html [more inside]
Sentiment Analysis basics in Rails
Learn how to do sentiment analysis in Rails to calculate whether content is positive, negative, or neutral using the Sentimental gem.
Using Service Worker on Rails
So far there hasn’t been a good story for using the new JavaScript API, Service Worker, in Rails applications – until now! Service workers come with some unique requirements for deployment that don’t play nice with the default behavior of the Rails asset pipeline. My latest post shows how I approached this problem and packaged my solution into a new Ruby gem. https://rossta.net/blog/service-worker-on-rails.html
Useful Utilities included in RubyGems & Confusing Hash Behavior
Good: You can use RubyGems itself to detect your OS, gzip compress strings, get a console password prompt, and more! Bad: The API for making hashes compare by object identity is not the most optimal!
How to Generate Weighted Random Numbers
Learn how you can write simple algorithms to pick weighted random numbers. http://www.blackbytes.info/2016/05/weighted-random-numbers/
Imagetragick and How to Protect Ruby Apps from it
There is a huge vulnerability in ImageMagick. In layman’s terms, if you are doing any kind of image manipulations like uploading avatars, photos, resizing stuff, you are most likely using ImageMagick and it concerns you. In theory, by uploading a specially crafted file (which may be not an image at all or an SVG image with some “features”), the attacker can gain access to your system. This is VERY bad. The “trademark” for it is Imagetragick: https://imagetragick.com/ Sysadmins should install a special policy file on their systems ASAP. [more inside]
Cells 4.1: Block Support, Better Collections, External Layouts!
Cells is a view model implementation for Ruby. The 4.1 release allows injecting external layout cells, finally supports block yielding in views, has a cool new collection API to render lists of cells, and much more.
[Pre-Launch] Your Virtual Rails Client
You taught yourself Ruby & Rails using books and online courses, but you don’t know how to build something useful from scratch? You don’t have an idea or can’t find existing projects to gain practical experience? [more inside]
Volt – A New Framework for Ruby
Volt - a new Framework for Ruby where both the server and client sides are written in Ruby via OPAL (a ruby to JavaScript compiler) so developer can write dynamic applications without writing a single JavaScript code.