Module: Skyline::HasManyReferablesIn

Defined in:
lib/skyline/has_many_referables_in.rb

Overview

Use this module in all models that have references to MediaFiles/Page/URL etc via WYSWIWYG-editors It adds the class method ‘has_many_referables_in`. With ClassMethods#has_many_referables_in you can use any text/string database field to have links/images that will refer correctly to their respective targets through RefObject

Examples:

Usage:

class Model < ActiveRecord::Base
  include Skyline::HasManyReferablesIn
  has_many_referables_in :body # :body is a database text/string field
end

Defines:

@model = Model.new
@model.body = "text <a href='http://www.google.com'>test</a>"
@model.body_before_typecast #=> The unconverted value which still includes [REF:XX] tags.
@model.body #=> Evertyhing is converted back to it's original state
@model.body(true) #=> The HTML includes extra attributes used for editing in the WYSIWYG-editor

See Also:

Defined Under Namespace

Modules: ClassMethods