Skip to content

Commit

Permalink
better bootstrap documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulca committed May 20, 2010
1 parent 1a766a4 commit b217293
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions generators/achievement/templates/achievement.rb
Expand Up @@ -8,12 +8,21 @@ class <%= class_name %> < Achievement

# set_thing_to_check { |user| ... }

def self.award_achievements_for(user)
return unless user
levels.each do |level|
if user.not.has_achievement?(self, level[:level]) and thing_to_check(user) >= level[:quota]
user.award_achievement(self, level[:level])
end
end
end
# Comment out below for multi-level achievements
# def self.award_achievements_for(user)
# return unless user
# levels.each do |level|
# if user.not.has_achievement?(self, level[:level]) and thing_to_check(user) >= level[:quota]
# user.award_achievement(self, level[:level])
# end
# end
# end

# Comment out below for once-off achievements
# def self.award_achievements_for(user)
# return unless user
# return if user.has_achievement?(self, level[:level])
# user.award_achievement(self, level[:level])
# end

end

0 comments on commit b217293

Please sign in to comment.