Skip to content

Instantly share code, notes, and snippets.

View xHire's full-sized avatar
☠️
Blocked by GitHub since 2024-01-26

xHire xHire

☠️
Blocked by GitHub since 2024-01-26
View GitHub Profile
@xHire
xHire / gist:3985883
Created October 31, 2012 08:37
Patch for Rails pull request #7282
diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb
index f529b71..c8fce49 100644
--- a/activemodel/lib/active_model/validations/length.rb
+++ b/activemodel/lib/active_model/validations/length.rb
@@ -45,7 +45,7 @@ module ActiveModel
CHECKS.each do |key, validity_check|
next unless check_value = options[key]
- if !value.nil? || key == :maximum && options[:allow_nil].nil? && options[:allow_blank].nil?
+ if value_is_not_nil_or_nil_is_allowed(value, key, options)
diff --git a/lib/activerecord-tableless.rb b/lib/activerecord-tableless.rb
index 83598c8..f865fed 100644
--- a/lib/activerecord-tableless.rb
+++ b/lib/activerecord-tableless.rb
@@ -16,8 +16,10 @@ module ActiveRecord
# has_no_table
#
# column :name, :string
- # column :email, :string
- # column :message, :string