Skip to content

Instantly share code, notes, and snippets.

@semmin
Created May 24, 2012 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save semmin/2783524 to your computer and use it in GitHub Desktop.
Save semmin/2783524 to your computer and use it in GitHub Desktop.
Package levels -- request for approval
# 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