Close and Go BackBack to Viget

Tools of the Trade

PUMA on Redis

David Eisinger
David Eisinger, Senior Developer, July 27, 2011

A few weeks ago, we celebrated the launch of the new PUMA.com, the culmination of a nearly two-year effort here at Viget. The whole site is driven by a CMS written in Rails, and I’m very proud of the technological platform we’ve developed. I want to focus on one piece of that platform, Redis, and how it makes the site both rock solid and screaming fast.

Continue reading "PUMA on Redis"

Static Asset Packaging for Rails 3 on Heroku

David Eisinger
David Eisinger, Senior Developer, March 29, 2011

Short Version: the easiest way to combine and minify static assets (CSS and Javascript) in your Rails 3 app running on Heroku is to use AssetPackager with this fork of Heroku Asset Packager. It just works.

Continue reading "Static Asset Packaging for Rails 3 on Heroku"

Bundler Best Practices

Chris Jones
Chris Jones, Developer, February 25, 2011

Bundler is a great tool to have in the Ruby toolbox, but it's also a bit mysterious to some developers. "Oh cool, I put my gems in this file, bundle install, and that's it. Wait, what's this Gemfile.lock thing? Should that go in my repo? What's the difference between bundle install and bundle update? How do I install my gems when I deploy? Where are my pants?" Let's take a tour of Bundler and find the answers to some of these questions.

Continue reading "Bundler Best Practices"

Emacs 24 Rails Development Environment - From *scratch* to Productive in 5 Minutes

Matt Swasey
Matt Swasey, Former Staffer, January 18, 2011

I'm a big fan of Emacs. My fellow employees at Viget enjoy a number of different editors including Textmate and Vim. I strongly believe that everyone should use an editor they feel productive in and most importantly, an editor they enjoy. So, I have no interest in engaging in any kind of editor holy war here.

I'd like to show you how you can go from a default installation of Emacs HEAD (24) to a workable Rails development environment in only a few minutes. I will make the following assumptions:

  1. You are running Mac OSX 10.6
  2. You have Xcode (< 4 beta) installed
  3. You have homebrew installed and working
  4. You have installed git using homebrew
  5. You are using rvm to manage your rubies and have a default configured.
  6. You have a basic understanding of Emacs

These instructions could likely be tweaked for different systems without too much fuss.

Let's begin!

Continue reading "Emacs 24 Rails Development Environment - From *scratch* to Productive in 5 Minutes"

Paperclip Custom Interpolations

Brian Landau
Brian Landau, Web Developer, January 13, 2011

As web developers something we often have to implement is handling file uploads. With Rails there are a number of plugins and gems for helping with this. The one I use most often is Paperclip. Out of the box, Paperclip does exactly what you want, and you don’t have to think about any configuration. But, as your application matures, your needs often change and some custom configuration is often required. One thing you’ll notice is that you can customize where the file is stored. The way that you do this (for those new to Paperclip) is:

has_attached_file :asset, :url => "/system/uploads/:class/:attachment/:id/:basename_:style.:extension"

On a recent project the client wanted us to store uploads in a very specific path structure. On the surface this seemed a simple enough request. As we dug deeper, though, it became clear that one part of the path needed to be based on the attribute of a model that was related to the model on which the file data was being stored. By default Paperclip only allows a limited set of values to be used in the path: filename, timestamp, rails_env, class, basename, extension, id, fingerprint, id_partition, attachment, and style. These predefined interpolations are all you need most of the time, but our case was the exception.

Continue reading "Paperclip Custom Interpolations"

We're the Developers

at Viget Labs. We write about web development trends, tips, best practices, industry events, and our projects — all with an emphasis on Ruby on Rails.

Upcoming Events

Future Insights Live - April 29 to May 4
Future of Web Apps, Future of Web Design, Future of Mobile, and Future of Web in the Enterprise have joined forces to bring you our most comprehensive event EVER!

Contact Us

Have any questions, comments, ideas, or secrets to share? Let us know.


What is the third letter in apple?

Sorry, you need to have Javascript enabled to use this form. (Don't blame us, blame the spammers!) If you'd like to contact us, please visit our Contact page.