ruby on rails - Converting an ActiveRecord:Relation to java array -


i running 'where' query running on table mytable in rails application. want convert results of specific column query(activerecord::relation) java array of string type.

this doing :

employeesjavaarray=mytable.where("salary = ?",100).pluck(:columnname).to_java(java.lang.string) 

however receiving error in logs :-

typeerror (could not coerce fixnum class java.lang.string): 

can please me out wrong statement have written.

i ensure array includes string (by calling to_s) first:

employeesjavaarray = mytable.where("salary = ?",100)                             .pluck(:columnname)                             .map(&:to_s)                             .to_java(java.lang.string) 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -