Sha256: ab94152e87b3ecccc1700de90bd26cd718f43985787e5417fe90e4dfa0ab7bf9
Contents?: true
Size: 926 Bytes
Versions: 3
Compression:
Stored size: 926 Bytes
Contents
# coding: utf-8 module Redditor class Page < ActiveRecord::Base self.table_name = "redditor_pages" belongs_to :pageable, polymorphic: true, touch: true has_many :text_blocks, class_name: "::Redditor::TextBlock" has_many :video_blocks, class_name: "::Redditor::VideoBlock" has_many :images, as: :imageable, class_name: "::Redditor::Image" has_many :slider_blocks, class_name: "::Redditor::SliderBlock" accepts_nested_attributes_for :text_blocks, allow_destroy: true accepts_nested_attributes_for :video_blocks, allow_destroy: true accepts_nested_attributes_for :slider_blocks, allow_destroy: true accepts_nested_attributes_for :images, allow_destroy: true def self.model_name ActiveModel::Name.new(self, nil, 'Page') end def content_blocks (text_blocks + video_blocks + images + slider_blocks).sort {|x, y| x.position <=> y.position} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redditor-0.1.17 | app/models/redditor/page.rb |
redditor-0.1.16 | app/models/redditor/page.rb |
redditor-0.1.15 | app/models/redditor/page.rb |