Sha256: cd427812c0602a9c6dc53eac7b8e232750e577a4f57cd9daa679c450153b7362
Contents?: true
Size: 932 Bytes
Versions: 3
Compression:
Stored size: 932 Bytes
Contents
require "redcarpet" module BitCore # A page of "static" or presentational content (as opposed to data capture). class Slide < ActiveRecord::Base belongs_to :slideshow, class_name: "BitCore::Slideshow", foreign_key: :bit_core_slideshow_id, inverse_of: :slides validates :title, :position, presence: true validates :position, numericality: { greater_than_or_equal_to: 1 } validates :position, uniqueness: { scope: :bit_core_slideshow_id } after_destroy :update_slide_positions def render_body return "" if body.nil? Redcarpet::Markdown.new( Redcarpet::Render::HTML.new( filter_html: true, safe_links_only: true ), space_after_headers: true ).render(body).html_safe end private def update_slide_positions slideshow.reload .sort(slideshow.slide_ids) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bit_core-2.0.0.beta1 | app/models/bit_core/slide.rb |
bit_core-1.4.6 | app/models/bit_core/slide.rb |
bit_core-1.4.5 | app/models/bit_core/slide.rb |