Module: Releasable
- Defined in:
- lib/releasable.rb,
lib/releasable/engine.rb,
lib/releasable/version.rb,
app/models/releasable/release.rb,
app/helpers/releasable/releasable_helper.rb,
app/controllers/releasable/releases_controller.rb,
app/controllers/releasable/application_controller.rb
Defined Under Namespace
Modules: ReleasableHelper Classes: ApplicationController, Engine, Release, ReleasesController
Constant Summary collapse
- ReleasableError =
Class.new(StandardError)
- VERSION =
"0.1.3"
Class Method Summary collapse
Class Method Details
.can_release?(key, user) ⇒ Boolean
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/releasable.rb', line 6 def self.can_release?(key, user) return false if key.nil? release = Releasable::Release.find_by(key: key) if release.present? return true if release.release_all? return false if user.nil? user_ids = release.user_ids.split(",").map(&:strip) raise ReleasableError, "User must have an ID" unless user.respond_to?(:id) return user_ids.include?(user.id.to_s) end false end |