Sha256: cf9e00cd48c8527eb39d5e0ce4eaf0b11a06eca85753184d7afc764808bef295

Contents?: true

Size: 537 Bytes

Versions: 7

Compression:

Stored size: 537 Bytes

Contents

module Rubix
  module Associations
    module BelongsToHost
      
      def host= h
        return unless h
        @host    = h
        @host_id = h.id
      end
      
      def host
        return @host if @host
        return unless @host_id
        @host = Host.find(:id => @host_id)
      end

      def host_id= hid
        return unless hid
        @host_id = hid
      end
      
      def host_id
        return @host_id if @host_id
        return unless @host
        @host_id = @host.id
      end

    end
  end
end

      

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubix-0.0.8 lib/rubix/associations/belongs_to_host.rb
rubix-0.0.7 lib/rubix/associations/belongs_to_host.rb
rubix-0.0.6 lib/rubix/associations/belongs_to_host.rb
rubix-0.0.5 lib/rubix/associations/belongs_to_host.rb
rubix-0.0.4 lib/rubix/associations/belongs_to_host.rb
rubix-0.0.3 lib/rubix/associations/belongs_to_host.rb
rubix-0.0.2 lib/rubix/associations/belongs_to_host.rb