Skip to content

Instantly share code, notes, and snippets.

@matthuhiggins
Created May 28, 2010 06:58
Show Gist options
  • Save matthuhiggins/416856 to your computer and use it in GitHub Desktop.
Save matthuhiggins/416856 to your computer and use it in GitHub Desktop.
class Article < ActiveRecord::Base
belongs_to :author
after_create do |article|
if article.title.blank?
article.title = "#{article.author.first_name}'s article about Rails 3"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment