1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/scoping
Ryuta Kamizono 8589e8c236 Allow define scope for Ruby reserved keywords
For now argument forwarding doesn't allow some keywords like `true` as a
method name.

To bypass the issue, fallback to `define_method` if method names are
Ruby reserved keywords.

https://bugs.ruby-lang.org/issues/16854

```ruby
class Works
  def true(*args)
    puts(*args)
  end
end

Works.new.true 1, 2, 3
# => 1, 2, 3

class WontWork
  def true(...)
    puts(...)
  end
end
```

```
% ruby a.rb
a.rb:12: syntax error, unexpected ..., expecting ')'
  def true(...)
a.rb:13: unexpected ...
a.rb:15: syntax error, unexpected `end', expecting end-of-input
```
2020-05-14 21:39:39 +09:00
..
default_scoping_test.rb Improve WhereClause#ast to make concise Arel ast 2020-04-25 18:46:10 +09:00
named_scoping_test.rb Allow define scope for Ruby reserved keywords 2020-05-14 21:39:39 +09:00
relation_scoping_test.rb Merge pull request #38319 from kamipo/make_default_scoped_public 2020-01-28 05:53:13 +09:00