Class: BitPlayer::Slide
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- BitPlayer::Slide
- Defined in:
- app/models/bit_player/slide.rb
Overview
A page of “static” or presentational content (as opposed to data capture).
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.update_positions(ids) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/models/bit_player/slide.rb', line 15 def self.update_positions(ids) transaction do connection.execute "SET CONSTRAINTS bit_player_slide_position DEFERRED" ids.each_with_index do |id, index| where(id: id).update_all(position: index + 1) end end end |
Instance Method Details
#render_body ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/bit_player/slide.rb', line 24 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 |