mirror of
https://github.com/discourse/discourse.git
synced 2024-12-13 23:04:42 +08:00
b806dce13d
- fetch models inside services - validate `user_id` in contracts - use policy objects - extract more logic to actions - write specs for services and action
20 lines
261 B
Ruby
20 lines
261 B
Ruby
# frozen_string_literal: true
|
|
|
|
class PolicyBase
|
|
attr_reader :context
|
|
|
|
delegate :guardian, to: :context
|
|
|
|
def initialize(context)
|
|
@context = context
|
|
end
|
|
|
|
def call
|
|
raise "Not implemented"
|
|
end
|
|
|
|
def reason
|
|
raise "Not implemented"
|
|
end
|
|
end
|