lib/randumb/relation.rb
# columns used for ranking must be a numeric type b/c they are multiplied
columns used for ranking must be a numeric type b/c they are multiplied
columns used for ranking must be a numeric type b / c they are multiplied
def raise_unless_valid_ranking_column(ranking_column)
        if ranking_column
          column_data = @klass.columns_hash[ranking_column.to_s]
          raise ArgumentError.new("random_weighted: #{ranking_column} is not a column on #{@klass.table_name}!") unless column_data
          raise ArgumentError.new("random_weighted: #{ranking_column} is not a numeric column on #{@klass.table_name}!") unless [:integer, :float].include?(column_data.type)
        end
      end
def raise_unless_valid_ranking_column ( ranking_column ) if ranking_column column_data = @klass . columns_hash [ ranking_column . to_s ] raise ArgumentError . new ( "random_weighted: #{ranking_column} is not a column on #{@klass.table_name}!" ) unless column_data raise ArgumentError . new ( "random_weighted: #{ranking_column} is not a numeric column on #{@klass.table_name}!" ) unless [ :integer , :float ] . include? ( column_data . type ) end end
columns used for ranking must be a numeric type b/c they are multiplied
columns used for ranking must be a numeric type b / c they are multiplied
ranking_column