module Writefully::Postable
Public Instance Methods
check_content_field_existence()
click to toggle source
# File lib/writefully/postable.rb, line 35 def check_content_field_existence unless respond_to?(:content) raise NoContentField, "No content field defined please define a content field" end end
klass_from(type_singular)
click to toggle source
# File lib/writefully/postable.rb, line 23 def klass_from type_singular type_singular == "tag" ? "Writefully::Tag" : type_singular.classify end
publish_resource()
click to toggle source
# File lib/writefully/postable.rb, line 27 def publish_resource if publish self.published_at = Time.now unless published_at.present? else self.published_at = nil end end
taxonomize_with(tokens, type)
click to toggle source
# File lib/writefully/postable.rb, line 17 def taxonomize_with(tokens, type) type_singular = type.to_s.singularize type_klass = klass_from(type_singular).constantize self.send(:"#{type_singular}_ids=", type_klass.ids_from_tokens(tokens)) end