Skip to content

Instantly share code, notes, and snippets.

@jwarchol
Forked from anonymous/gist:9016
Created September 5, 2008 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwarchol/9020 to your computer and use it in GitHub Desktop.
Save jwarchol/9020 to your computer and use it in GitHub Desktop.
class Update < ActiveRecord::Base
belongs_to :job_id, :foreign_key => 'job_id', :class_name => 'Job'
file_column :attachment
def authorized_for_destroy?
return false if new_record?
return Update.count(:conditions => ["created_at > ?", self.created_at]) == 0
end
def authorized_for_update?
false
end
def before_create
self.author_email = "#{current_user}@engr.uconn.edu"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment