RubyFlow The Ruby and Rails community linklog

×

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

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

Logging local & instance variables when exceptions occur in Ruby

With hard-to-reproduce bugs, it can be really handy to log all of the local and instance variables along with the exception. This post shows you how. Along the way we’ll introduce Ruby’s binding system as well as the binding_of_caller gem - a powerful tool for introspection. http://blog.honeybadger.io/log-local-variables-and-instance-variables-when-exceptions-occur-in-ruby/

Introducing TestChanges gem

TestChanges is a light-weight gem for testing only the files that have changed since a given commit. You tell it what your test tool is, what files to watch, and what tests to run. It’s similar to guard, except that you have to run it manually and the configuration format is YAML. [more inside]

Keep your data types in check! Rails compatible validator to assert types.

No one is particularly fond of littering their code with trys and is_a?s. To remedy this, I make my models assert confidence that the data in my database is what I expect. I’m not talking about type coercion, type casting or any other munging of types that might happen on a typical read/write from your handy dandy ORM of choice. No no, this is the real deal, the bees knees, the elbows of a gazelle: actual type validation.

A web server vs. an app server

When you research how to deploy your Rails app, you’ll see a lot of names: Apache, Unicorn, Puma, Phusion Passenger, Nginx, Rainbows, and many more. Some are “web servers,” and others are “app servers.” But what’s a web server, and how is it different than an app server? Can you use one without the other? And where does Rack fit in?

Ruby’s case statement – advanced techniques

Nothing could be simpler and more boring than the case statement. It’s a holdover from C. You use it to replace a bunch of ifs. Case closed. Or is it? Actually, case statements in Ruby are a lot richer and more complex than you might imagine. Let’s take a look. http://blog.honeybadger.io/rubys-case-statement-advanced-techniques/

` class Success def self.===(item) item.status >= 200 && item.…
Loading older posts