module ShareableModels::Models::Shareable
Define a model as shareable. A shareable model can be shared between other models called sharers. Imagine a platform with privates articles, you could want to share your awesome article with other person, so make it shareable.
Public Instance Methods
allow_edit(from, to)
click to toggle source
editable_by?(from)
click to toggle source
leave_by(sharer)
click to toggle source
prevent_edit(from, to)
click to toggle source
Prevent a sharer to edit the resource. First parameter is to set same format of allow_edit.
Parameters:¶ ↑
- from
-
Sharer
that want to allow another to edit resource - to
-
Sharer
that will be able to edit the resource
Returns:¶ ↑
True if it’s ok
# File lib/shareable_models/models/shareable.rb, line 144 def prevent_edit(from, to) from.prevent_edit(self, to) end
readable_by?(from)
click to toggle source
throw_out(from, to)
click to toggle source