Skip to content

Commit

Permalink
improve project's public property handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sr committed Jul 20, 2008
1 parent a1376f5 commit 0d40fd5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/integrity/project.rb
Expand Up @@ -16,7 +16,6 @@ class Project
has n, :builds, :class_name => "Integrity::Build"

before :save, :set_permalink
before :save, :set_public
before :destroy, :delete_code

validates_is_unique :name
Expand All @@ -37,14 +36,12 @@ def previous_builds
return [] if builds.count <= 1
builds.all(:order => [:created_at.desc], :offset => 1, :limit => builds.count - 1)
end

def public=(flag)
attribute_set(:public, !!flag)
end

private

# DM refuses to set "on" as true.
def set_public
self.public = !!(public)
end

def set_permalink
self.permalink = (name || "").downcase.
gsub(/'s/, "s").
Expand Down

0 comments on commit 0d40fd5

Please sign in to comment.