-
-
Save jwarchol/9020 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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