I am running a 'where' query which is running on a table MyTable in my rails application.
I want to convert the results of a specific column from this query(ActiveRecord::Relation) to Java Array of String type.
This is what I am doing :
employeesJavaArray=MyTable.where("salary = ?",100).pluck(:columnName).to_java(java.lang.String)
TypeError (could not coerce Fixnum to class java.lang.String):
I would ensure that the array only includes string (by calling
employeesJavaArray = MyTable.where("salary = ?",100) .pluck(:columnName) .map(&:to_s) .to_java(java.lang.String)