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.
Generate API documentation from RSpec examples with the DOX gem
Writing API documentation is a boring task, manual updating leads to errors and it’s time consuming. [more inside]
Basically Basic, Minimal Mistakes, HPSTR & More - Jekyll Themes by Michael Rose
Hello, to celebrate Jekyll passing ★30 000 GitHub stars (the fastest growing web framwork in Ruby today ;-)) - lets also celebrate and thank Michael Rose for the outstanding (free, open source, and well-documented) static website themes incl. Basically Basic, Minimal Mistakes, HPSTR, So Simple & Skinny Bones. PS: You might also enjoy Michael Rose’s classic How I’m Using Jekyll in 2016. Happy publishing w/ Jekyll & friends.
Everyday Rails Testing with RSpec updated for 2017
Hi, I’ve given my book on testing Rails apps with RSpec a major overhaul for 2017. There’s an all-new sample app using RSpec 3.6 and Rails 5.1, expanded coverage of API testing, and general updates to reflect my current testing philosophies. I hope you’ll check it out. It’s a free update for existing readers, and I wouldn’t turn down new readers :)
Git Cop 1.0.0
Having worked on many teams where Git commit messages have been non-descriptive; hard to reason about what has been committed; inconsistent; and so forth, I’m happy to announce the release of Git Cop 1.0.0. Now you have a tool, like Rubocop, that will help ensure good Git behavior on your feature branches so undesired commits never make it to master! Git Cop can be wired in as a Git Hook or, better yet, be added as part of your build process so feature branch builds fail if commits are bad (recommended). Let feature branch code reviews be focused on architecture and high level discussions while Git Cop takes care of reviewing Git commit behavior. All Git Cop checks are completely customizable for your team’s style guide, see the README for details. [more inside]
[Screencast] Working with Subdomains
Learn to create a multi-tenant application where access to tenants are determined by the subdomain. https://www.driftingruby.com/episodes/working-with-subdomains
Top 22 Open Source Jekyll Static Website Themes - June Edition Update @ Dr Jekyll's
Hello, I’ve updated the Dr. Jekyll’s Top 22 Open Source Static Website Themes page. Congrats to #1 Jekyll Now ★ 3653 by Barry Clark; #2 Poole ★ 2178 by Mark Otto; #3 Minimal Mistakes ★ 2068 by Michael Rose and all the runner ups. Happy publishing with Jekyll & friends. PS: Any theme missing? New themes welcome.
New Book: Demystifying Rails
How Rails conventions work from first principles. https://medium.com/launch-school/new-book-demystifying-rails-e076b345d484
Open Data w/ Ruby - Football Confederations Cup Russia'17 - $ sportdb new confed2017
Hello,
today opens the Football Confederations Cup in Russia. To celebrate the open football.db now includes public domain datasets for the Confed Russia’17 match schedule / tournament. Use the sportdb gem / tools to read in the plain text fixtures
into your SQL database of choice (thanks to ActiveRecord).
Use $ sportdb new confed2017.rb to download the zip archives, build the schema
and read/parse the datasets resulting in a single-file SQLite football.db. Enjoy the beautiful game. Cheers.
How can I protect a user's file uploads in Rails?
Having files on your website to be seen by the world is quite easy. But what if you don’t want them to be available for free? Here is how you can secure them using Rails and Paperclip. https://chrisherring.co/posts/how-can-i-protect-a-user-s-file-uploads-in-rails
Class methods do not exist in Ruby
A fun little TIL moment I had while looking at the Ruby source code. [more inside]
Build a query parser
A step by step tutorial to building a query parser for Elasticsearch using Parslet.
Choose Your Rails 5 Default Stack
You can set up your Rails app the same way every time using a template that meets only your preferences. Or you can learn to use another stack that’s not an exact match for your preferences, but good enough to get the job done with minor tweaks. [more inside]
Use a Constant for Associations, not class_name
Relying on a class name constant you’ve defined within your application for setting up associations is much better for reliability and refactoring than merely using a string. Read for the implications and implementation: http://blog.nrowegt.com/rails-associations-class-name-best-practice/
From Rails to Hanami: Views
Third of the series “From Rails to Hanami”, this time talking about Views! https://blog.codeminer42.com/from-rails-to-hanami-views-66d27bcba404
Common Table Expressions in ActiveRecord: A Case Study of Quantiles
An in depth look at how to perform statistical calculations using PostgreSQL and AREL. https://sonnym.github.io/2017/06/05/common-table-expressions-in-activerecord-a-case-study-of-quantiles/
Using Codeship for Ruby Application Deployments
The second part in this two-part series covers how to take a simple todo API using Ruby on Rails and PostgreSQL with Docker Compose - from part 1 - and creating a CI/CD pipeline using Codeship Pro. Link here
Using Docker Compose for Ruby Development
The first in a two-part series covers the development and testing of a simple Ruby API with Docker Compose. Link here
Validate plain old Ruby objects with Active Model Validations
A while ago I wrote about creating a landing page with Sinatra, Google Spreadsheets and Ruby. The app had a flaw though, any user data was valid and would post through to the spreadsheet. So here’s how to validate user data in plain old ruby objects using ActiveModel::Validations.