I have this model attributes :
class CreateRoles < ActiveRecord::Migration
# create role model with relation to users and projects
def change
create_table :roles do |t|
t.references :user
t.references :project
t.boolean :senior_author , :default => 0
t.boolean :first_author , :default => 0
t.boolean :author , :default => 0
t.boolean :bio_informatician, :default => 0
end
end
end
My form is :
form do |f|
f.inputs "Details" do # Project's fields
f.input :title
f.input :code
end
f.has_many :roles do |app_f|
app_f.inputs do
if !app_f.object.nil?
app_f.input :_destroy, :as => :boolean, :label => "Effacer"
end
app_f.input :user, :include_blank => false, :label_method => :to_label
#app_f.input :senior_author
#app_f.input :first_author
#app_f.input :author
#app_f.input :bio_informatician
end
end
f.buttons
end
How can I make a collection () or a radio button of the four last app_f.input ?
You can use collection attribute
f.input :user, collection: User.all.map{|u| [u.name, u.id]}
I don't know if this will help you, but I think is very stranger the formtastic don't make a selection with records.