1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
if request.post?
@unit = Unit.new(params[:unit])
# @myhash = Hash.new
# @myhash[:company_id] = session[:user][:company_id]
# @myhash[:last_modified_by_user_id] = session[:user][:id]
# # Convert the user supplied cash amount into the pennies format for storage in the DB
# params[:unit][:monthly_rent_amount] = dollars_to_cents(params[:unit][:monthly_rent_amount])
#
# @unit = Unit.create(params[:unit].merge(@myhash))
# if @unit.valid?
# flash[:message]="Unit Added Successfully, #{@unit.due_day}"
# redirect_to :controller => 'unit', :action => 'show', :id => @unit.id
# return
# else
# # Here we set the params back to the user-supplied string, because the save failed.
# @unit.monthly_rent_amount = cents_to_dollars(@unit.monthly_rent_amount)
# end
else
@unit = Unit.new
end
|

