Skip to content

Instantly share code, notes, and snippets.

@pcalcado
pcalcado / gist:2500286
Created April 26, 2012 15:14
pre checkin for legacy/slow rails apps
#!/bin/bash
function specs_to_run(){
git status | grep rb$ | awk '{print $3}' | sed -e "s/^[a-z][a-z]*/spec/g" | sed -e "s/[a-z_]*.rb$/\*/g" | sort | uniq
}
echo "Need to run these before checking-in:"
specs_to_run
bundle exec spec `specs_to_run | xargs -L 1000 echo`
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private