Using to_sentence method on an Array in Ruby on Rails    
  
    
Member.all.collect {|member| member.firstname}.to_sentence
=> "Alex, Andy, and Sean"
Declare separator and the connector 
Member.all.collect {|member| member.firstname}.to_sentence(
  :connector => "and last but not least,", 
  :skip_last_comma => tr...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Collection Select Helper and OnChange Event in Rails  
  
    Given a collection of Active Record objects, you may use the collection_select helper method to produce a select form field. You need to pass in a number of arguments to the helper function.
1) object - your model object used in the collection
2) method ...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Repost   
  
    This post is inspired by 
http://pupeno.com/blog/really-resetting-the-database/#comment-1179. But as my blog mostly serves as a reference for my future self, I'd like to reprint this little snippet of code here as well. 
namespace :db do
  desc "Crush a...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Rounded Corners with CSS  
  
    
.rounded_corners {
     -moz-border-radius: 20px;
    -webkit-border-radius: 20px;
    -khtml-border-radius: 20px;
    border-radius: 20px;
}
  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Select Distinct in Rails with Active Record  
  
    
User.find :all, :select => "DISTINCT occupation"
  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    A List of Every High School in the United States in Pipe Delimitted Form (2005)  
  
    Here is a text file containing every high school in the United States(2005), including city, state, zip code and high school name. 
us_high_schools_pd  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    The Context of Markup vs Expressions of Equality in Determining the Meaning of Angled Brackets  
  
    In the Wordpress editor (html mode) you'll need to become friends with < and > if you plan on showing any code (php, html... xml, most languages actually) that readers  will want to understand. 
I never thought about it, but assumed that the lt and...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Simple Activity Stream Implementation in Rails  
  
    There are many ways to tackle the Facebook style activity stream feature for your app. The simplest approach, which you can tack on at almost any moment, is what I'll describe here. You don't have to create a new model for news feed items or create any po...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Scope Routes/URLs By Username (like Twitter) in Your Rails Application  
  
    There are a few things that need to be taken care of before you can get this to work. The first thing (although, any of the following steps can be done in any order) to take care of involves your User model. You need to override the to_param method, so th...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Using Formtastic to Cleanly Create Nice Looking Forms in Rails  
  
    Forms can easily get cluttered when you're dealing with a lot of form fields... er, ERB tags. I've written about extending Rails form builders, which certainly goes along way to shrinking your views where forms are used. The plugin Formtastic is even bett...  
  
    
      Written by Sean Behan on 06/17/2012