title: Redmine Adding Custom Selection Box
body: <p>I have started working on a plugin for redmine that will allow me to assign a Quickbooks Online (QBO) contact to an issue.</p>
  
  <p>I have created a table for the contacts that only stores a name for each qbo contact.</p>
  
  <p>I have also added a migration to add a reference for qbo_contact to Issues</p>
  
  <pre><code>class UpdateIssues &lt; ActiveRecord::Migration
    def change
      add_reference :issues, :qbo_customer, index: true
    end
  end
  </code></pre>
  
  <p>The issue I am having is that when the issue is being edited, the user can select a QBO contact. When the user saves the issue, Issues.qbo_contact_id is not updated.</p>
  
  <p>I feel it might have something to do with the form selection box</p>
  
  <p>Please Advise</p>
  
  <pre><code>class QboHookListener &lt; Redmine::Hook::ViewListener
  
    # Edit Issue Form
    # Show a dropdown for quickbooks contacts
    def view_issues_form_details_bottom(context={})
      selected = ""
  
      # Check to see if there is a quickbooks user attached to the issue
      if not context[:issue].qbo_customer_id.nil? then
        selected = QboCustomers.find_by_id(context[:issue].qbo_customer_id).name
      end
  
      # Generate the drop down list of quickbooks contacts
      select = context[:form].select :qbo_customer_id, QboCustomers.all.pluck(:name, :id), include_blank: true, selected: selected
      return "&lt;p&gt;#{select}&lt;/p&gt;"
  
      #TODO save selection to Issues.qbp_customer_id
    end
  end
  </code></pre>
  
  <p>If you need more, I have shared my work on <a href="https://github.com/rickbarrette/redmine_qbo" rel="nofollow">github</a></p>