We Recommend

The Rails Way The Rails Way
Now, for the first time, there’s a comprehensive, authoritative guide to building production-quality software with Rails. Pioneering Rails developer Obie Fernandez and a team of experts illuminate the entire Rails API, along with the Ruby idioms, design approaches, libraries, and plug-ins that make Rails so valuable.


Posted By

edwinjanmoss on 10/18/07


Tagged


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

shovanjoshi


Avoid duplicate column Error in Migration


Published in: Rails 


Add "rescue nil" to migration commands that you want the migration to try but don't care if it fails. Helpful for debugging migrations and helpful when you want to modify a previous migration, let's say add a column, and you don't want the remove column in the drop block to choke your reverse migration.


  1. add_column :users, :ssn_part, :string rescue nil

Report this snippet 

You need to login to post a comment.