The application I'm working on has just been updated today from Rails 4.0 to Rails 4.1 because some guys needed a newer version of Active Admin. The piece of code below, which was working with the previous version of AA, is not displayed anymore, for some reason.
I've got a form embedding a has_one relationship that in turn has another has_one relationship, so here is how it looks:
form do |f|
#some code
f.inputs "Chef d'établissement", for: [:chef_etablissement, f.object.chef_etablissement || ChefEtablissement.new] do |cetb|
cetb.input :civilite_gabriel_id, label: "Civilité", :as => :select,
:collection => Civilite.all.map{|c| ["#{c.libelle_long.capitalize}", c.id_gabriel]},
include_blank: false
cetb.input :nom_patro
cetb.input :nom
cetb.input :prenom_usuel
cetb.input :mail1
cetb.inputs "Adresse Cetb", for: [:adressecommunication, cetb.object.adressecommunication || Adressecommunication.new] do |adrcetb|
adrcetb.input :adresse1
adrcetb.input :adresse2
adrcetb.input :adresse4, label: "Type de voie"
adrcetb.input :adresse3
adrcetb.input :adresse5, label: "Mention"
adrcetb.input :code_postal
adrcetb.input :ville
end
end
I reckon this has something to do with the "cetb.inputs" part overwriting my previous "cetb.input" instructions since when I do comment my "cetb.input" lines, the form appears but I can't really figure out a way of doing it the proper way. I mean, putting the "cetb.input" lines in the "cetb.inputs for:" part would make it all displayed but it's not really what I'm looking for since I'd have a useless fieldset and that would look rather ugly.
Any hints welcome, thanks !
cetb.inputsto docetb.has_one :addresscommunication