Sha256: 355838c73fc528d4b93f91994a555a162fac3e34ddc8e7fdf88b0f57356f4232
Contents?: true
Size: 952 Bytes
Versions: 25
Compression:
Stored size: 952 Bytes
Contents
module Writefully class Site < ActiveRecord::Base self.table_name = "writefully_sites" extend FriendlyId HOOK_EVENTS = %w(push collaborator) friendly_id :name, use: :slugged after_save :setup_repository, if: -> { repository.nil? } after_save :clear_errors, if: -> { healthy_changed? and healthy? } belongs_to :owner, class_name: "Writefully::Authorship" has_many :posts, -> { order(:position) } def setup_repository Writefully.add_job :handyman, { task: :build, auth_token: owner.data["auth_token"], user_name: owner.data["user_name"], site_id: id, site_slug: slug } end def processing_errors Writefully.redis.with { |c| c.smembers "site:#{self.id}:errors" } end def clear_errors Writefully.redis.with { |c| c.del("site:#{self.id}:errors") } end end end
Version data entries
25 entries across 25 versions & 1 rubygems