Cannot find to_s method for #{Set}, Cequel set model attribute with Rails

82 Views Asked by At

In Cequel this is my model for RoR,

class Fileinfo
  include Cequel::Record

  key :fileid, :timeuuid, auto: true
  column :filepath, :text, :index => true
  set :test, :int

  timestamps
end

Rails scaffold generates the form which is used for new,create apis() like this

 <div class="field">
    <%= f.label :fileid %><br>
    <%= f.text_field :fileid %>
  </div>
  <div class="field">
    <%= f.label :filepath %><br>
    <%= f.text_field :filepath %>
  </div>

  <div class="field">
    <%= f.label :test %><br>
    <%= f.text_field :test %>
  </div>

When i start the rails4 server, I get a error for the test(Set Datatype) field undefined method to_s for #{Set } at this line in the rails form <%= f.text_field :test %>.

Even if i define the method to_s the issue persists. Any idea where and how the to_s method needs to be defined here.

1

There are 1 best solutions below

0
On

No Option other then creating a drop down multi select ComboBox and sending data to the rails controller in json format and parsing it there before using it as Set.

Done the same in case for Android + Rails server