File tree Expand file tree Collapse file tree 3 files changed +4
-23
lines changed
lib/active_record/scoping Expand file tree Collapse file tree 3 files changed +4
-23
lines changed Original file line number Diff line number Diff line change 1+ * Remove deprecated ` scope ` use without passing a callable object.
2+
3+ * Arun Agrawal*
4+
15* Remove deprecated ` transaction_joinable= ` in favor of ` begin_transaction `
26 with ` :joinable ` option.
37
Original file line number Diff line number Diff line change @@ -141,19 +141,6 @@ def scope_attributes? # :nodoc:
141141 def scope ( name , body , &block )
142142 extension = Module . new ( &block ) if block
143143
144- # Check body.is_a?(Relation) to prevent the relation actually being
145- # loaded by respond_to?
146- if body . is_a? ( Relation ) || !body . respond_to? ( :call )
147- ActiveSupport ::Deprecation . warn (
148- "Using #scope without passing a callable object is deprecated. For " \
149- "example `scope :red, where(color: 'red')` should be changed to " \
150- "`scope :red, -> { where(color: 'red') }`. There are numerous gotchas " \
151- "in the former usage and it makes the implementation more complicated " \
152- "and buggy. (If you prefer, you can just define a class method named " \
153- "`self.red`.)"
154- )
155- end
156-
157144 singleton_class . send ( :define_method , name ) do |*args |
158145 if body . respond_to? ( :call )
159146 scope = all . scoping { body . call ( *args ) }
Original file line number Diff line number Diff line change @@ -435,16 +435,6 @@ def test_scoped_are_lazy_loaded_if_table_still_does_not_exist
435435 end
436436 end
437437
438- def test_eager_scopes_are_deprecated
439- klass = Class . new ( ActiveRecord ::Base )
440- klass . table_name = 'posts'
441-
442- assert_deprecated do
443- klass . scope :welcome_2 , klass . where ( :id => posts ( :welcome ) . id )
444- end
445- assert_equal [ posts ( :welcome ) . title ] , klass . welcome_2 . map ( &:title )
446- end
447-
448438 def test_eager_default_scope_relations_are_remove
449439 klass = Class . new ( ActiveRecord ::Base )
450440 klass . table_name = 'posts'
You can’t perform that action at this time.
0 commit comments