From 49062c12edc4b5397ea3bc6680eb6a13bdec2164 Mon Sep 17 00:00:00 2001 From: Rashmi Yadav Date: Fri, 1 Nov 2013 18:07:27 +0100 Subject: [PATCH] exists? is deprecated in ruby trunk [ci skip] see here 4d4ff531b8807ee88a3fc46875c7e76f613956fb --- guides/source/active_record_callbacks.md | 4 ++-- guides/source/initialization.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md index aa2ce99f6d..cabcf0c7c8 100644 --- a/guides/source/active_record_callbacks.md +++ b/guides/source/active_record_callbacks.md @@ -290,7 +290,7 @@ Here's an example where we create a class with an `after_destroy` callback for a ```ruby class PictureFileCallbacks def after_destroy(picture_file) - if File.exists?(picture_file.filepath) + if File.exist?(picture_file.filepath) File.delete(picture_file.filepath) end end @@ -310,7 +310,7 @@ Note that we needed to instantiate a new `PictureFileCallbacks` object, since we ```ruby class PictureFileCallbacks def self.after_destroy(picture_file) - if File.exists?(picture_file.filepath) + if File.exist?(picture_file.filepath) File.delete(picture_file.filepath) end end diff --git a/guides/source/initialization.md b/guides/source/initialization.md index fe6b1ad906..7e9cb5a47d 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -54,7 +54,7 @@ The `APP_PATH` constant will be used later in `rails/commands`. The `config/boot # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) ``` In a standard Rails application, there's a `Gemfile` which declares all @@ -121,7 +121,7 @@ when 'server' # Change to the application's path if there is no config.ru file in current directory. # This allows us to run `rails server` from other directories, but still get # the main config.ru and properly set the tmp directory. - Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru")) + Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exist?(File.expand_path("config.ru")) require 'rails/commands/server' Rails::Server.new.tap do |server| -- GitLab