Ruby on Rails Dropdown Select

This should be easy for anyone that knows Rails. I simply need a dropdown select that is populated from mysql using active record. If active record is not needed all the better.

What have I tried? Searching and searching and searching and have started at the beginnning with rails tutorials. Never seen rails before today. Already hate it. I could do this in 5 seconds in Php.

CONTEXT

Why am I going to ROR? I joined a team with the Technology Association of Oregon that is taking over an existing project to analyze speed test data and compare to what the providers are reporting to the FCC and to identify rural areas that are lacking in high speed internet. The original application was created in ROR and is in bad shape. It originally came from a hackathon which explains the poor quality. We have a meeting coming up shortly with the County Commissioners to present this to them so we do not have time for a re-write at this time. There are 9 senior devs struggling with this code. If your interested, the project came from “speed up your city” and is live in a few city’s. This is the live app https://www.speeduplouisville.com/ and was forked from https://github.com/louisvillemetro-innovation/SpeedUpYourCity

We are open to new team members of any skill. The ultimate goal is to launch this project across America. Yesterday, money was allocated to story points for issues that you fix. I may be mistaken but I think it is $100 a point.

Normally you can do something like this:

<%= form_for @post do |f| %>
  <%= f.select :person_id, Person.all.collect { |p| [ p.name, p.id ] }, include_blank: true %>
  <%= f.submit %>
<% end %>

Where Post and Person are your models.

This will give you sth. like:

<select name="post[person_id]">
  <option value=""></option>
  <option value="1" selected="selected">David</option>
  <option value="2">Sam</option>
  <option value="3">Tobias</option>
</select>

Ref:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.