TIL, 2017-12-05
- Ruby boolean to int: No easy way? Either you define
class TrueClass def to_i 1
etc. - Reading Gitlab’s base service.
Allowable
moduleCurrentSettings
to retrieve app things from database or cache.NotificationService
as a component to send emails. Each possible email is in theNotificationService
.EventCreateService
which creates anEvent
row in the database if an event is created.TodoService
which is like the same asEvent
but forTodos
.
TodosFinder
does the thing where if something is passed add awhere
clause but if not just return the same thing. So you extract the actual querying logic into the finder.
def by_type(items)
if type?
items = items.where(target_type: type)
end
items
end