method

to_h

Importance_0
v6.0.0 - Show latest stable - 0 notes - Class: WhereClause
to_h(table_name = nil) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/relation/where_clause.rb, line 49
      def to_h(table_name = nil)
        equalities = equalities(predicates)
        if table_name
          equalities = equalities.select do |node|
            node.left.relation.name == table_name
          end
        end

        equalities.map { |node|
          name = node.left.name.to_s
          value = extract_node_value(node.right)
          [name, value]
        }.to_h
      end
Register or log in to add new notes.