Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK, I found the issue. The issue was coming from my partial form view which I use for my 'edit' action and for my 'new' action : /app/views/admin/admin_utilisateurs/_form.html.haml</p> <pre><code>= form_for @admin_utilisateur, :url =&gt; admin_admin_utilisateur_path, :html =&gt; {:class =&gt; "formulaire-standard"} do |f| = render :partial =&gt; 'shared/error_message', :locals =&gt; { :element =&gt; @admin_utilisateur, :debut_erreur =&gt; 'Cet utilisateur ne peut être enregistré'} .groupe-champs .champ = f.label :nom = f.text_field :nom, :class =&gt; 'input-width-8-col', :required =&gt; 'required' .champ = f.label :prenom = f.text_field :prenom, :class =&gt; 'input-width-5-col', :required =&gt; 'required' .champ = f.label :telephone = f.telephone_field :telephone, :class =&gt; 'input-width-5-col', :required =&gt; 'required' .champ = f.label :mobile = f.telephone_field :mobile, :class =&gt; 'input-width-5-col' .champ = f.label :email = f.email_field :email, :class =&gt; 'input-width-8-col', :required =&gt; 'required' .groupe-champs = render :partial =&gt; 'shared/checkboxes_admin_utilisateur', :locals =&gt; { :resource =&gt; @admin_utilisateur } .groupe-champs .champ-1 = f.check_box :approved .champ-5 = f.label :approved .checkbox-explication = t('activerecord.attributes.admin_utilisateur.explanations.active') .separator .groupe-actions = f.submit 'Enregistrer', :class =&gt; 'btn-text btn-dimensions btn-encrusted metal' = link_to 'Annuler', admin_admin_utilisateur_path, :class =&gt; 'btn-text btn-dimensions btn-encrusted metal' </code></pre> <p>I was using the form_for tag incorrectly. Because my form is used within a namespace, I must add the namespace into its arguments, and remove the :url option because otherwise this form will only work with the 'edit' action :</p> <pre><code>= form_for [:admin, @admin_utilisateur], :html =&gt; {:class =&gt; "formulaire-standard"} do |f| </code></pre> <p>This code lets Rails guess what path to use wether it's for a new record or to edit an existing record. So I don't need to specify the :url and the :method.</p> <p>The second mistake was (a classical one) the link_to at the bottom of the form. I forgot the 's' at the end of the route helper (admin_admin_utilisateurSSSS_path):</p> <pre><code>= link_to 'Annuler', admin_admin_utilisateurs_path, :class =&gt; 'btn-text btn-dimensions btn-encrusted metal' </code></pre> <h1>The moral of the story :</h1> <p><strong>ALLWAYS CHECK YOUR /log/development.log FILE !</strong> ;-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload