title: select list association in cakephp
body: <p>i am new to cake and using version 2.</p>
  
  <p>i have models</p>
  
  <pre><code>hgcylinder.php
  
  class HgCylinder extends AppModel  {
      //put your code here
      var $name= "HgCylinder";
  
      var $belongsTo = array('HgKeyGase');
  }
  
  hgkeygase.php
  class HgKeyGase extends AppModel  {
      //put your code here
      var $name= "HgKeyGase";
  
  
      public $belongsTo = array(
          'HgKeyColor' =&gt; array(
              'className' =&gt; 'HgKeyColor',
              'foreignKey' =&gt; 'hg_key_color_id',
              'conditions' =&gt; '',
              'fields' =&gt; '',
              'order' =&gt; ''
          )
          );
  
  }
  
  Controller HgCylindersController.php
  
  &lt;?php
  
  class HgCylindersController extends AppController
  {
      var $name = "HgCylinders";
      // var $scaffold;
      function index()
      {
          $this-&gt;set('hey',$this-&gt;HgCylinder-&gt;find('all'));
      }
  
  
      public function edit($id = null) {
          $this-&gt;HgCylinder-&gt;id = $id;
          if ($this-&gt;request-&gt;is('post')) {
          var_dump($this-&gt;request-&gt;data);
          exit;
              if ($this-&gt;HgCylinder-&gt;save($this-&gt;request-&gt;data)) {
                  $this-&gt;Session-&gt;setFlash(__('Cylinder has been updated successfull'));
                  $this-&gt;redirect(array('action' =&gt; 'index'));
              } else {
                  $this-&gt;Session-&gt;setFlash(__('The cylinder could not be saved. Please, try again.'));
              }
          } else {
              $this-&gt;request-&gt;data = $this-&gt;HgCylinder-&gt;read(null, $id);
          }
          $hg_key_gase_id = $this-&gt;HgCylinder-&gt;HgKeyGase-&gt;find('list');
  
          $this-&gt;set(compact('hg_key_gase_id'));
      }
  
  } 
  
  ?&gt;
  
  View : edit.ctp
  &lt;?php 
  
  echo $this-&gt;form-&gt;create('HgCylinder',array('action'=&gt;'edit'));
  echo $this-&gt;form-&gt;input('hg_key_gase_id',);
  echo $this-&gt;form-&gt;input("capacityM3");
  echo $this-&gt;form-&gt;input("weightEmpty");
  echo $this-&gt;form-&gt;input("weightFilled");
  echo $this-&gt;form-&gt;input("isFilled");
  echo $this-&gt;form-&gt;end('Add');
  ?&gt;
  </code></pre>
  
  <p>my problem is hg_key_gase_id is become select list with no options. if i changed the name to "hgKeyGas" in view and controller it shows the options from the hg_key_gases table. but on saving does not saving the value of hg_key_gase_id field in hg_cylinders table instead it stores null in this field.</p>
  
  <p>second i want to know that it is necessary to have variable name passing to view from controller exactly same for as field in table.</p>