title: how to save from data from session to the database?
body: <p>I'm currently using rails 3 app. How am I supposed to save data from session to the database?</p>
  
  <p>Here's my controller:</p>
  
  <pre><code>def step2
      @cart = current_cart
  
      checkin = params[:checkin]
      checkout = params[:checkout]
      @amenities = Amenity.available(checkin, checkout)
  
      session[:checkin] = checkin
      session[:checkout] = checkout
  end
  </code></pre>
  
  <p>and my view:</p>
  
  <pre><code>&lt;%= form_for(@transaction, :validate =&gt; true) do |f| %&gt;
  
      &lt;%= f.hidden_field :Transaction_Date, :value =&gt; Time.now %&gt;
      &lt;%= f.hidden_field :rsv_type, :value =&gt; "Online" %&gt;
      &lt;%= f.hidden_field :rsv_status, :value =&gt; "Pending" %&gt;
      &lt;%= f.hidden_field :checkin, :value =&gt; session[:checkin] %&gt;
      &lt;%= f.hidden_field :checkout, :value =&gt; session[:checkout] %&gt;
  
  &lt;% end %&gt;
  </code></pre>