Turning off x_send_file in development mode
I just discovered the great x_send_file plugin and technique and use it extensivly for daily fratze. I replaced the majority of send_file calls with x_send_file but not all (the in memory thingies i serve cannot be send through apache). This works great in production mode but in development mode, it fails as there is no apache sitting in front the mongrels. Therefore i added the following to my $app_home/config/environments/development.rb:
class ActionController::Base
def x_send_file(path, options = {})
send_file(path, options)
end
end |
So all calls to x_send_file in dev mode are delegated to the original send_file.
If anyone can present me a cleaner solution, i.e. with method aliasing, feel free to drop a comment.
Share This
I just discovered the great x_send_file plugin and technique and use it extensivly for daily fratze. I replaced the majority of send_file calls with x_send_file but not all (the in...
— Trackback URI
This entry (permalink) was posted on Wednesday, January 23, 2008, at 5:06 pm by Michael, tagged with Code Snippets, Rails, Ruby and categorized in English posts, Rails.
The following post could be of some interest: Rails 2.1: send_file :x_sendfile => true, Copy and paste within cmd (command interpreter under Windows), Linux: Persistent wake-on-lan, Grails: Completely disable stacktrace.log file, Optimizing web resources with wro4j, Spring and ehcache, WordPress 2.2.1 Update / Security Fix, Java and invalid SSL certificates (java-trustprovideragent), A little vpn zoo, Installing Oracle 11g Database on OEL5, Git snippets
One Trackback/Pingback
[...] I’ll guess i stay with the x_send_file solution as described here. [...]
Post a Comment