Created
September 5, 2008 20:26
-
-
Save anonymous/9016 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? | |
require 'pp' | |
pp self | |
if created.nil? then | |
false | |
else | |
system "echo 1 >/tmp/here" | |
newer_updates = Update.find_by_sql( | |
"SELECT * FROM updates | |
WHERE | |
(created > '#{self.created.strftime("%Y-%m-%d %H:%M:%S")}')" | |
) | |
if (newer_updates.length==0) then | |
true | |
else | |
false | |
end | |
end | |
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