0
我目前正在使用rails 3應用程序。我應該如何將數據從會話保存到數據庫?如何從會話數據保存到數據庫?
這裏是我的控制器:
def step2
@cart = current_cart
checkin = params[:checkin]
checkout = params[:checkout]
@amenities = Amenity.available(checkin, checkout)
session[:checkin] = checkin
session[:checkout] = checkout
end
和我的觀點:
<%= form_for(@transaction, :validate => true) do |f| %>
<%= f.hidden_field :Transaction_Date, :value => Time.now %>
<%= f.hidden_field :rsv_type, :value => "Online" %>
<%= f.hidden_field :rsv_status, :value => "Pending" %>
<%= f.hidden_field :checkin, :value => session[:checkin] %>
<%= f.hidden_field :checkout, :value => session[:checkout] %>
<% end %>