Class Project
In: app/models/project.rb
Parent: ActiveRecord::Base

API for interaction with the database table ‘projects’, and it‘s related data model.

Methods

get  

Attributes

host  [RW]  Accessor methods.

Public Class methods

Retrieve the project corresponding to this request.

The object returned by this method is a tree structure containing all logical project elements that are involved in the generation of the requested page. Within this tree structure the project object occupies the root node. For more information refer to the architectural documentation.

[Source]

    # File app/models/project.rb, line 24
24:   def self.get (
25:     env
26:   )
27:     # Every page access is a request for a particular project host; thus host 
28:     # information is the first information available. Accordingly, the project 
29:     # host related to a URL request is established first, and this is in turn 
30:     # used to determine the project.
31:     host = ProjectHost.get(env)
32: 
33: 
34:     # If this host is configured to return another host then obtain that host.
35:     while (host.act_as_project_host_id &&
36:            act_as_host = ProjectHost.find(host.act_as_project_host_id))
37:       act_as_env              = env
38:       act_as_env['HTTP_HOST'] = act_as_host.name
39:       host                    = ProjectHost.get(act_as_env)
40:     end
41: 
42: 
43:     # Obtain the default project in the case that this is a host of the default
44:     # project. Note that the 'active' field is ignored for this query, as this 
45:     # provides basic failure mode functionality and this result must be     
46:     # available at all times.
47:     if (DEFAULT_PROJECT_ID == host.project_id)
48:       project = find(host.project_id)
49:     else
50:       project = find_by_id_and_active(host.project_id, 'TRUE')
51:     end
52: 
53: 
54:     # Populate the project host for this request.
55:     project.host = host
56: 
57: 
58:     project
59:   end

[Validate]