I have the following model
class Business < ApplicationRecord {
:id => :integer,
:business_name => :string,
:place_id => :string,
:surburb => :string,
:type => :text,
:created_at => :datetime,
:updated_at => :datetime
}
I am sending a JSON object to my api create method this is my object
business_params = {
:business_name => "Endah Parade",
:surburb => "Taman Sri Endah",
:type => [
[0] "premise",
[1] "point_of_interest",
[2] "establishment"
],
:place_id => "ChIJixfh-49KzDERePyk34svbaY"
}
In my controller i run the following
business = Business.create!(business_params)
but i get the error TypeError (no implicit conversion of Array into String). My type column was defined as this
change_column :businesses, :type, :text, array: true, default: [], using: "(string_to_array(type, ','))"
So at least i know that my type column can accept array but i am not sure why i get this error.
In my Business Model, i added the following as well serialize :type, Array but it also doesnt help. I get the same error.
How can i solve this issue?
I am using Rails 5.1