Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
+ if @rentable.checkedout?
+ flash[:error] = "This #{@rentable.type} is already checked out!"
+ redirect_to :action => :rent_begin
+ return
+ end
+
+ # Check out the item
+ checkout = Coitem.new
+ checkout.customer = @customer
+ checkout.rentable = @rentable
+ checkout.out_date = Time.now.to_date
+ checkout.due_date = @rentable.due_date
+ checkout.save!
+
# Actually record the purchase
purchase = RentablePurchase.new
purchase.customer_id = session[:customer_id]
# Actually record the purchase
purchase = RentablePurchase.new
purchase.customer_id = session[:customer_id]
# FIXME: generate this based on day of week, newrelase
return 11
end
# FIXME: generate this based on day of week, newrelase
return 11
end
+
+ def due_date
+ # FIXME: generate this based on the day of week, newrelease
+ return Time.now.advance(:days => 2).to_date
+ end
+
+ def due_date
+ # FIXME: generate this based on the day of week, newrelease
+ return Time.now.advance(:days => 2).to_date
+ end
+
protected
def validate
errors.add(:video_genre, "does not exist in the database") if video_genre.nil?
protected
def validate
errors.add(:video_genre, "does not exist in the database") if video_genre.nil?
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
- <title>Bitem: <%= controller.action_name %></title>
+ <title>Purchase: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
</head>
<body>
<%= stylesheet_link_tag 'scaffold' %>
</head>
<body>