Sha256: 4991f88d2f5d7a4c9cddda54d272b4a64d2baa2d33f71ce93a5416ec4557f645

Contents?: true

Size: 706 Bytes

Versions: 7

Compression:

Stored size: 706 Bytes

Contents

module Product::ProjectManagement
  extend ActiveSupport::Concern 
  
  included do
    has_many :stories, dependent: :nullify
  end
  
  module ClassMethods
    def stories(id, user, page)
      collection = if id == 'no-name'
        Story.exists(_type: false)
      else
        product = Product.find(id)
        
        begin
          product.story_class.for_user(user)
        rescue NotImplementedError
          product.story_class
        end
      end
      
      collection.where(:users_without_tasks_ids.ne => user.id)#.page(page).per(1)
    end
  end
    
  def projects; Project.where(product_id: id); end
  
  def story_class; "#{self.class.name}::Story".constantize rescue Story; end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
voluntary-0.1.0.rc4 app/models/product/project_management.rb
voluntary-0.1.0.rc3 app/models/product/project_management.rb
voluntary-0.1.0.rc2 app/models/product/project_management.rb
voluntary-0.1.0.rc1 app/models/product/project_management.rb
voluntary-0.0.3 app/models/product/project_management.rb
voluntary-0.0.2 app/models/product/project_management.rb
voluntary-0.0.1 app/models/product/project_management.rb