Ruby 1.9 fixes

This commit is contained in:
Aria Stewart 2010-09-18 16:35:48 -06:00
parent 7d0db11444
commit 45b6ff53f1
3 changed files with 4 additions and 3 deletions

View file

@ -21,9 +21,9 @@ class PhotosController < ApplicationController
# get file content type
att_content_type = (request.content_type.to_s == "") ? "application/octet-stream" : request.content_type.to_s
# create temporal file
file = Tempfile.new(file_name)
file = Tempfile.new(file_name, {encoding: 'BINARY'})
# put data into this file from raw post request
file.print request.raw_post
file.print request.raw_post.force_encoding('BINARY')
# create several required methods for this temporal file
Tempfile.send(:define_method, "content_type") {return att_content_type}

View file

@ -22,7 +22,7 @@ class Photo < Post
timestamps!
validates_presence_of :album
validates_true_for :album_id, :logic => lambda {self.validate_album_person}
validates_true_for(:album_id, :logic => Proc.new { self.validate_album_person })
before_destroy :ensure_user_picture

View file

@ -6,6 +6,7 @@
# This file is used by Rack-based servers to start the application.
$LOAD_PATH << '.'
require ::File.expand_path('../config/environment', __FILE__)
#use Rack::FiberPool
#require 'lib/chrome_frame'