Sha256: 2a4f69fcb993b69712bbe64a74f649f8460187c936a603c90f723409aef759e3
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
# coding: utf-8 module Redditor class Page < ActiveRecord::Base self.table_name = "redditor_pages" # attr_accessible :pageable_id, :pageable_type, :metakey, :metadesc, :text_blocks_attributes, :video_blocks_attributes, :images_attributes, :slider_blocks_attributes belongs_to :pageable, polymorphic: 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 (self.text_blocks + self.video_blocks + self.images + self.slider_blocks).sort {|x, y| x.position <=> y.position} end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
redditor-0.1.12 | app/models/redditor/page.rb |
redditor-0.1.11 | app/models/redditor/page.rb |
redditor-0.1.10 | app/models/redditor/page.rb |
redditor-0.1.9 | app/models/redditor/page.rb |