app/models/bit_player/slide.rb in bit_player-0.1.1 vs app/models/bit_player/slide.rb in bit_player-0.1.2
- old
+ new
@@ -10,12 +10,17 @@
validates :title, :body, :position, presence: true
validates_numericality_of :position, greater_than_or_equal_to: 1
validates_uniqueness_of :position, scope: :bit_player_slideshow_id
def render_body
- markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, space_after_headers: true)
+ rendered = ""
- markdown.render(body).html_safe
+ if !body.nil?
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, space_after_headers: true)
+ rendered += markdown.render(body).html_safe
+ end
+
+ rendered
end
def self.update_positions(ids)
transaction do
connection.execute "SET CONSTRAINTS slide_position DEFERRED"