You can replace the templates that the scaffold generator uses by creating alternative templates in a lib/templates/erb/scaffold
folder in your application root.
In this case, you will want to copy the original _form.html.erb
template and replace the text field with a collection_select:
<%- if attribute.reference? -%>
<%%= f.label :<%= attribute.column_name %> %><br>
- <%%= f.<%= attribute.field_type %> :<%= attribute.column_name %> %>
+ <%%= f.collection_select :<%= attribute.column_name %>, <%= attribute.name.camelize %>.all, :id, :name, prompt: true %>
<%- else -%>
More details can be read in my post on the subject.