class Writefully::Tools::Stationery
Attributes
asset[R]
content[R]
index[R]
site_id[R]
Public Class Methods
new(index)
click to toggle source
# File lib/writefully/tools/stationery.rb, line 12 def initialize(index) @site_id = Site.where(slug: index[:site]).first.id @index = index @content = Content.new(index) @asset = Asset.new(index) end
Public Instance Methods
perform()
click to toggle source
# File lib/writefully/tools/stationery.rb, line 19 def perform use ensure ::ActiveRecord::Base.clear_active_connections! if defined?(::ActiveRecord) end
Private Instance Methods
compute_type()
click to toggle source
# File lib/writefully/tools/stationery.rb, line 27 def compute_type index[:resource].classify.constantize rescue NameError fallback_type end
fallback_type()
click to toggle source
# File lib/writefully/tools/stationery.rb, line 33 def fallback_type if index[:resource] == "posts" "Writefully::Post".constantize else raise ContentModelNotFound, "Model #{index[:resource].classify} was not found" end end