Module: Skyline::Referable

Included in:
Sections::WysiwygSection
Defined in:
lib/skyline/referable.rb

Overview

Use this module in all models that have references to MediaFiles/Pages etc via WYSWIWYG-editors It adds the class method ‘referable_field`. With ClassMethods#referable_field 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::Referable
  referable_field :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

Defined Under Namespace

Modules: ClassMethods