Sha256: 60396f9fd6b2b118b33dff0af746e6a5086e57f8ea9edb0a5a6615380e7fc253

Contents?: true

Size: 719 Bytes

Versions: 12

Compression:

Stored size: 719 Bytes

Contents

module Rubix
  module Associations
    module HasManyUserGroups
      
      def user_groups= ugs
        return unless ugs
        @user_groups    = ugs
        @user_group_ids = ugs.map(&:id)
      end
      
      def user_groups
        return @user_groups if @user_groups
        return unless @user_group_ids
        @user_groups = @user_group_ids.map { |ugid| UserGroup.find(:id => ugid) }
      end

      def user_group_ids= ugids
        return unless ugids
        @user_group_ids = ugids
      end
      
      def user_group_ids
        return @user_group_ids if @user_group_ids
        return unless @user_groups
        @user_group_ids = @user_groups.map(&:id)
      end
      
    end
  end
end

      

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rubix-0.5.14 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.13 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.9 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.8 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.7 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.6 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.5 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.4 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.3 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.2 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.1 lib/rubix/associations/has_many_user_groups.rb
rubix-0.5.0 lib/rubix/associations/has_many_user_groups.rb