title: Grails - How save params to controller from another controller
body: <p>i have a specific question; </p>
  
  <p>I'm newbie on grails i'm trying to write some test app with this scenario; </p>
  
  <p>I have 2 Domain Classes </p>
  
  <p>1- Car 
  2- Registration </p>
  
  <p>I want to add some cars with brand, model etc. And user will choose from list some car and click to rent car button. When user will click to rent car button will open the registration/create page here i want to get car:id of user selected car and user will enter some extra information from himself like Your Name and when user will click to save button on registration/list i need to see registrations with car:id and your name entry</p>
  
  <p>In car class i have list of cars, with this field here is my car model; </p>
  
  <pre><code>package rentme
  
  class Car {
  
      String brand
      String model
      String fuelType
      BigDecimal pricePerDay
      String busy
  
      static constraints = {
          brand(inList:["AUDI", "BMW", "MERCEDES", "NISSAN", "HONDA", "FORD"])
          model()
          fuelType(inList:["FUEL", "DIESEL", "AUTOGAS"])
          pricePerDay(min:0.0, max:1000.0)
          busy(inList:["YES", "NO"])
  
      }
  }
  </code></pre>
  
  <p>And i have Registration class, </p>
  
  <pre><code>package rentme
  
  class Registration {
  
      String yourName
  
  
  
      static constraints = {
          yourName()
      }
  }
  </code></pre>
  
  <p>So what i did , </p>
  
  <p>i add the cars/index.gsp this link in g:each; </p>
  
  <pre><code>&lt;g:each in="${carList}" var="car"&gt;
                      &lt;p&gt;${car.id} &lt;/p&gt;
                      &lt;g:link action="create" controller="registration" params="${[car: car, carId : car.id ]}"&gt;
                          Rent Car
                      &lt;/g:link&gt;
  
                  &lt;/g:each&gt;
  </code></pre>
  
  <p>and modified Registration Controller like that;</p>
  
  <pre><code> def index(Integer max) {
          params.max = Math.min(max ?: 10, 100)
          respond Car.list(params), model:[carCount: Car.count()]
      }
  </code></pre>
  
  <p>Now what happened; When i click to rent button page redirect to registration/create page with the catching id which car user selected; </p>
  
  <p>here is my registration/create.gsp </p>
  
  <pre><code> &lt;g:form action="save"&gt;
                  &lt;div&gt;&lt;p&gt;Car ID : ${car.id} &lt;/p&gt;&lt;/div&gt;
                  &lt;fieldset class="form"&gt;
                      &lt;f:all bean="registration"/&gt;
                  &lt;/fieldset&gt;
                  &lt;fieldset class="buttons"&gt;
                      &lt;g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /&gt;
                  &lt;/fieldset&gt;
              &lt;/g:form&gt;
  </code></pre>
  
  <p>And when fill your name field and click to save button everything is okey, So like it's working but not :) </p>
  
  <p>because when i check the my db i don't see there selected car id.</p>
  
  <pre><code>mysql&gt; SELECT * FROM registration;
  +----+---------+--------------+
  | id | version | your_name    |
  +----+---------+--------------+
  | 12 |       0 | Cihan Zengin |
  | 13 |       0 | Cihan        |
  | 14 |       0 | ndlkdkldnkl  |
  +----+---------+--------------+
  </code></pre>
  
  <p>But when i click to registration/index or registration/show there is have just your name value but i want to see there car:id too. </p>
  
  <p>How to do that? Please someone tell me that because i can't understand and can't found nowhere something like that in internet</p>