ref: master
plugins/video/lib/ext/article.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
require_dependency 'article' class Article scope :video_gallery, -> { where "articles.type = 'VideoPlugin::VideoGallery'" } #FIXME This should be done via hotspot def self.folder_types_with_video self.folder_types_without_video << 'VideoPlugin::VideoGallery' end #FIXME This should be done via hotspot class << self alias_method_chain :folder_types, :video end def self.owner_video_galleries(owner) conditions = owner.kind_of?(Environment) ? [] : ["profile_id = ?", owner.id] result = Article.video_gallery .order('created_at desc') .where(conditions) end end |