5
3
mirror of https://github.com/tildeverse/lobsters synced 2024-06-14 04:56:39 +00:00

accidentally committed from branch; not ready yet

This commit is contained in:
Peter Bhat Harkins 2020-08-18 20:21:10 -05:00
parent 13c5c359c2
commit 359abfe24f

View File

@ -1,17 +0,0 @@
class StoryText < ApplicationRecord
self.primary_key = :id
belongs_to :story, foreign_key: :id, inverse_of: :story_text
validates :body, presence: true, length: { :maximum => 16_777_215 }
def self.read_through_cache(story)
return nil unless story.url.present?
st = StoryText.find_or_initialize_by id: story.id
return st.body if st.body.present?
result = StoryCacher.get_story_text(self)
# you're here, finish
end
end