Created
May 24, 2012 18:54
-
-
Save semmin/2783524 to your computer and use it in GitHub Desktop.
Package levels -- request for approval
This file contains hidden or 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
# lib/package_level/package_level.rb | |
module PackageLevel | |
module CareerSection | |
module Bronze | |
class Config | |
class << self | |
attr_accessor :max_active_job_postings, | |
:max_employers, | |
:max_job_postings_error_text, | |
:max_employers_error_text | |
end | |
def self.configure | |
yield self | |
end | |
end | |
end | |
end | |
end | |
# config/initializers/package_level.rb | |
PackageLevel::CareerSection::Bronze::Config.configure do |config| | |
config.max_active_job_postings = 5 | |
config.max_job_postings_error_text = "is limited to five active job postings" | |
config.max_employers = 1 | |
config.max_employers_error_text = "cannot have more than one division" | |
end | |
#app/models/job_posting.rb | |
if company.job_postings.active.count >= PackageLevel::CareerSection::Bronze::Config.max_active_job_postings | |
.................. | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment