jeudi 20 août 2015

Rails select from database

Can somebody explain this ? , it is from ruby guides

<%= collection_select(:person, :city_id, City.all, :id, :name) %>

I have an attachment model, I want to select its version with combobox when I create an object, and also I want a new version option.

here what attachment has

def change
create_table :attachments do |t|
  t.string :filename
  t.attachment :file
  t.string :version
  t.text :description
  t.timestamps null: false
end

Aucun commentaire:

Enregistrer un commentaire