Module: Rubix::Associations::HasManyApplications

Included in:
Item
Defined in:
lib/rubix/associations/has_many_applications.rb

Instance Method Summary collapse

Instance Method Details

#application_idsObject


22
23
24
25
26
# File 'lib/rubix/associations/has_many_applications.rb', line 22

def application_ids
  return @application_ids if @application_ids
  return unless @applications
  @application_ids = @applications.map(&:id)
end

#application_ids=(aids) ⇒ Object


17
18
19
20
# File 'lib/rubix/associations/has_many_applications.rb', line 17

def application_ids= aids
  return unless aids
  @application_ids = aids
end

#applicationsObject


11
12
13
14
15
# File 'lib/rubix/associations/has_many_applications.rb', line 11

def applications
  return @applications if @applications
  return unless @application_ids
  @applications = @application_ids.map { |aid| Application.find(:id => aid, :host_id => host_id) }
end

#applications=(hs) ⇒ Object


5
6
7
8
9
# File 'lib/rubix/associations/has_many_applications.rb', line 5

def applications= hs
  return unless hs
  @applications    = hs
  @application_ids = hs.map(&:id)
end