Module: Rubix::Associations::BelongsToMediaType

Included in:
Medium, Operation
Defined in:
lib/rubix/associations/belongs_to_media_type.rb

Instance Method Summary collapse

Instance Method Details

#media_typeObject



12
13
14
15
16
# File 'lib/rubix/associations/belongs_to_media_type.rb', line 12

def media_type
  return @media_type if @media_type
  return unless @media_type_id
  @media_type = MediaType.find(:id => @media_type_id)
end

#media_type=(mt) ⇒ Object



6
7
8
9
10
# File 'lib/rubix/associations/belongs_to_media_type.rb', line 6

def media_type= mt
  return unless mt
  @media_type    = mt
  @media_type_id = mt.id
end

#media_type_idObject



23
24
25
26
27
# File 'lib/rubix/associations/belongs_to_media_type.rb', line 23

def media_type_id
  return @media_type_id if @media_type_id
  return unless @media_type
  @media_type_id = @media_type.id
end

#media_type_id=(mtid) ⇒ Object



18
19
20
21
# File 'lib/rubix/associations/belongs_to_media_type.rb', line 18

def media_type_id= mtid
  return unless mtid
  @media_type_id = mtid
end