mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-28 22:36:21 +00:00
21 lines
370 B
Ruby
21 lines
370 B
Ruby
|
class InvitadxPolicy
|
||
|
attr_reader :usuarix, :model
|
||
|
|
||
|
def initialize(usuarix, model)
|
||
|
@usuarix = usuarix
|
||
|
@model = model
|
||
|
end
|
||
|
|
||
|
def new?
|
||
|
create?
|
||
|
end
|
||
|
|
||
|
# Al crear, el modelo recibido es un sitio
|
||
|
def create?
|
||
|
raise ArgumentError, "#{model.class} must be Site" unless model.class == Site
|
||
|
|
||
|
# El sitio acepta invitadxs
|
||
|
model.invitadxs?
|
||
|
end
|
||
|
end
|