Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

Form with references field

1
Rails

I have a form with references field:

<%= form.label :name, style: "display: block" %>
<%= form.text_field :name %>

<%= form.label :city_id_id, style: "display: block" %>
<% cities_array = City.all.map { |city| [city.name, city.id] } %>
<%= select_tag :cities_array, options_for_select(cities_array) %>

But this error is showing after send form:

ActiveRecord::StatementInvalid in EntitiesController#create
SQLite3::SQLException: no such table: main.city_ids

Hello,

Yes, I checked the database and saw that my error was when I generated the model, putting the city_id:references field instead of just city:references.

Thanks

Join the discussion
Create an account Log in