Yuval Hager - Drupal development and consulting

  • About
  • Services
  • Contact

Easy nginx with Drupal

Submitted by yhager on Mon, 02/01/2010 - 17:07

If you are impatient, the code is at nginx_drupal. If you want to know what it’s about - read on.

I recently needed to set up a consistent web server configuration for a Drupal web site. That site has 6 web servers and 3 images servers. The goal was to have a single nginx configuration file, with as little duplication as possible. The images servers are meant for the static content, and for imagecache only.

Although the servers are different (some are meant for generic web, some are meant just as images servers) I wanted to have a generic config, that will give maximum flexibility to the administrator. Such a config file can reside in a single location on the internal network, and be accessible from all servers through NFS.

  • Read more
Tags:
  • boost
  • drupal
  • nginx

Using option groups with acts_as_tree

Submitted by yhager on Fri, 12/18/2009 - 17:14

When you have a model that acts_as_tree, you might want to use that to generate a nice select element with option groups.

In your view, simply use:

<%= f.select (:category_id, option_groups_from_collection_for_select(
    Category.top,
    :children, :name, 
    :id, :name
    )) %>

and add a method to your model:

def self.top
  find(:all, :conditions => [ 'parent_id IS NULL' ])
end 

This generates HTML like this:

<select id="product_category_id" name="product[category_id]">
  <optgroup lab
  • Add new comment
  • Read more
Tags:
  • acts_as_tree
  • rails

Simple outgoing mail server on Archlinux

Submitted by yhager on Wed, 12/09/2009 - 18:08

It is very common to need an outgoing mail capabilities. If you are using a VPS for your web site, or just you want outgoing mails on your home machine to work natively. Automatic messages from cron, UPS management, or even your blog about new comments are too important to lose.

I am using ArchLinux, but this guide is probably good for other distributions as well. I could not find a simple and concise guide for setting this up - this post is aimed to fill that gap.

First let’s install Postfix (why postfix?

  • Add new comment
  • Read more
Tags:
  • linux
  • mail
  • postfix
Syndicate content
I love Smashing Magazine!
Fervens Drupal theme by Leow Kah Thong. Designed by Design Disease and brought to you by Smashing Magazine.