Rails simple-form association not saving
<p>Am new to RoR and Simple_form. I have a simple set-up where I have an association between 2 classes. The form I use is not updating/saving and always setting the value back to blank. Looked at the docs and other postings, what am I doing wrong?</p>

<p><strong>Classes</strong></p>

<pre><code>class Annotation &lt; ApplicationRecord
has_many :comments, dependent: :destroy
belongs_to :documenttype
has_attached_file :file, styles: { large: "600x600&gt;", medium: "500x500&gt;", thumb: "150x150#" }, default_url: "/images/:style/missing.png"

accepts_nested_attributes_for :documenttype

validates_attachment_content_type :file, content_type: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf']
validates :name, presence: true, uniqueness: true, length: { minimum: 10, maximum: 50 }
    validates :description, length: { minimum: 20, maximum: 500 }
    validates :documenttype, presence: true
    validates :file, presence: true

end

class Documenttype &lt; ApplicationRecord
    has_many :annotations
    validates :name, presence: true, uniqueness: true, length: { minimum: 5 }
end
</code></pre>

<p><strong>Params</strong></p>

<pre><code>def annotation_params
 params.require(:annotation).permit(:name, :description, :file, :active, :documenttype)
end

def documenttype_params
 params.require(:documenttype).permit(:name, :description, :active, annotation_attributes: [:id, :name])
end
</code></pre>

<p>This is the form...</p>

<pre><code>    &lt;div class="container-fluid"&gt;
  &lt;div class="row"&gt;
    &lt;div class="col-md-6"&gt;
      &lt;%= simple_form_for @annotation,  html: { class: 'form-horizontal', multipart: true },
        wrapper: :horizontal_form,
        wrapper_mappings: {
            check_boxes: :horizontal_radio_and_checkboxes,
            radio_buttons: :horizontal_radio_and_checkboxes,
            file: :horizontal_file_input,
            boolean: :horizontal_boolean
          } do |f| %&gt;

          &lt;%= f.error_notification %&gt;

            &lt;%= f.input :name, placeholder: 'Enter name' %&gt;

            &lt;%= f.input :description, placeholder: 'Description' %&gt;

            &lt;%= f.association :documenttype %&gt;

          &lt;%= f.input :active, as: :boolean %&gt;

          &lt;% if @annotation.file.blank? %&gt;
            &lt;%= f.input :file, as: :file %&gt;
            &lt;% else %&gt;
          &lt;% end %&gt;

          &lt;%= f.button :submit %&gt;
          &lt;% unless @annotation.file.blank? %&gt;
          &lt;%= link_to ' Annotate', annotations_path, :class =&gt; "btn btn-default" %&gt;
          &lt;% end -%&gt;

      &lt;% end %&gt;

      &lt;p&gt;&lt;br&gt;&lt;%= link_to 'List' , annotations_path %&gt;&lt;/p&gt;

    &lt;/div&gt;

      &lt;div class="col-md-6"&gt;
        &lt;% unless @annotation.file.blank? %&gt;
          &lt;%= image_tag @annotation.file.url(:large) %&gt;
        &lt;% end %&gt;
      &lt;/div&gt;

  &lt;/div&gt;
</code></pre>