Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
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
This paste will be private.
From the Design Piracy series on my blog: