Skip to content

Loading…

Added warning on @send_on #15

Merged
merged 1 commit into from

2 participants

@dmasur

Hi,

i added this warning, cause i run into this problem while upgrading an app.

Nice work so far, thanks
TBAA

@radar
Ruby on Rails member

Sorry to nitpick, but please avoid making whitespace changes in commits. This is just so the diff for the commit matches the commit message, making the diff shorter and more focussed and that it's easy enough to revert this one thing without the whitespaces changes also.

Thanks!

@radar radar merged commit 3a035e6 into rails:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 2, 2012
  1. @dmasur
Showing with 24 additions and 9 deletions.
  1. +24 −9 lib/application_checker.rb
View
33 lib/application_checker.rb
@@ -50,15 +50,15 @@ def check_ar_methods
)
end
end
-
+
def check_validation_on_methods
files = []
-
+
["validate_on_create", "validate_on_update"].each do |v|
lines = grep_for(v, "app/models/")
files += extract_filenames(lines) || []
end
-
+
unless files.empty?
alert(
"Updated syntax for validate_on_* methods",
@@ -68,15 +68,15 @@ def check_validation_on_methods
)
end
end
-
+
def check_before_validation_on_methods
files = []
-
+
%w(before_validation_on_create before_validation_on_update).each do |v|
lines = grep_for(v, "app/models/")
files += extract_filenames(lines) || []
end
-
+
unless files.empty?
alert(
"Updated syntax for before_validation_on_* methods",
@@ -223,7 +223,7 @@ def check_generators
unless generators.empty?
files = generators.reject do |g|
- grep_for("def manifest", g).empty?
+ grep_for("def manifest", g).empty?
end.compact
unless files.empty?
@@ -267,7 +267,7 @@ def check_old_helpers
lines += grep_for("<% .*form_tag.* do.*%>", "app/views/**/*")
lines += grep_for("<% .*fields_for.* do.*%>", "app/views/**/*")
lines += grep_for("<% .*field_set_tag.* do.*%>", "app/views/**/*")
-
+
files = extract_filenames(lines)
if !files.blank?
@@ -343,6 +343,21 @@ def check_old_session_setting
end
end
+ #Check for old ActionMailer :send_on attributes
+ def check_old_action_mailer_send_on_setting
+ files = []
+ lines = grep_for("@sent_on", "app/*")
+ files += extract_filenames(lines) || []
+
+ unless files.empty?
+ alert(
+ "Deprecated ActionMailer attribute :send_on",
+ "This is deprecated without replace.",
+ "http://stackoverflow.com/questions/7367185/weird-error-when-delivering-mail-undefined-method-index-for-2011-09-09-2215",
+ files
+ )
+ end
+ end
private
def grep_for_with_perl_regex(text, where = "./", double_quote = false)
grep_for(text, where, double_quote, true)
@@ -355,7 +370,7 @@ def grep_for_with_perl_regex(text, where = "./", double_quote = false)
def grep_for(text, where = "./", double_quote = false, perl_regex = false)
# If they're on Windows, they probably don't have grep.
@probably_has_grep ||= (Config::CONFIG['host_os'].downcase =~ /mswin|windows|mingw/).nil?
-
+
# protect against double root paths in Rails 3
where.gsub!(Regexp.new(base_path),'')
Something went wrong with that request. Please try again.