class Guidance

Project:

DMPonline v4

Description:

This class keeps the information organisations enter to support users when answering questions. It always belongs to a guidance group class and it can be linked directly to a question or through one or more themes

Created:

07/07/2014

Copyright:

Digital Curation Centre

Public Class Methods

by_organisation(org_id) click to toggle source

all guidance that belong to an organisation

# File app/models/guidance.rb, line 40
def self.by_organisation(org_id)
        all_guidance = Guidance.all
        org_guidance = Array.new
    
        all_guidance.each do |guidance|
           if guidance.in_group_belonging_to?(org_id) then
                        org_guidance << guidance
           end
        end
        
        return org_guidance
        
end

Public Instance Methods

get_guidance_group_templates?(guidance_group) click to toggle source
# File app/models/guidance.rb, line 55
def get_guidance_group_templates? (guidance_group)
                templates = guidancegroups.where("guidance_group_id (?)", guidance_group.id).template 
                return templates
        end
in_group_belonging_to?(organisation_id) click to toggle source

verifies if one guidance belongs to a org

# File app/models/guidance.rb, line 29
def in_group_belonging_to?(organisation_id)
        guidance_groups.each do |guidance_group|
                if guidance_group.organisation_id == organisation_id then
                        return true
                end
        end
        return false
end