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.

Paginating Database Results In Rails Active Record

Paginating database results is a standard feature of most web applications, yet isn’t something you’d want to necessarily implement on your own. Fortunately, Rails developers have a whole host of options at their disposal, including the will_paginate gem. This post shows you how to easily integrate will_paginate into your Rails application. Read the post.

ActiveModel::Serializers - MetaCasts.tv*

In this episode we will use TDD to write a custom JSON serializer using ActiveModel::Serializers. We’ll learn about how to use scope to determine which attributes to serialize. We’ll also look at some of the changes in the forth coming 0.9.0 release, including breaking changes around using URL helpers in a serializer. [more inside]

How to improve your software design with code that feels wrong

You know what you want to do, but your code just isn’t cooperating. Maybe it has a few too many levels of indentation, or chains a half dozen methods, or looks asymmetrical. Whatever it is, something just feels off. You could ignore it – I mean, you have a backlog full of features you still want to write, and it’s really not that bad. But that would be a mistake: Your code is trying to tell you something, and you don’t want to miss it.

Rails 4, Strong Parameters, and Deprecation of the attr_accessible Macro

The attr_accessible macro has long been a Rails mainstay, playing a major role in preventing malicious access of sensitive model attributes. However it (and its sibling attr_protected) was deprecated in Rails 4 in preference of a new approach known as “strong parameters”. In the latest Easy Active Record blog entry I introduce strong parameters, explaining why attr_accessible was inconvenient and demonstrating the advantages gained by the new strong parameters approach.

Terminal colours made simple

On Sunday, I released a small side-project of mine, a gem called tco. It’s a tool to simplify colouring things in the terminal. The main feature of it is the way it works with colours. Instead of an oddly organised sequence of colour codes, tco simply works with RGB. It provides a library for your Ruby gems and apps, and also a standalone command-line tool that you can use anywhere else. [more inside]

Loading older posts