mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
6187b7138c
```ruby steve = Person.find_by(name: "Steve") david = Author.find_by(name: "David") relation = Essay.where(writer: steve) # Before relation.rewhere(writer: david).to_a # => [] # After relation.rewhere(writer: david).to_a # => [david] ``` For now `rewhere` only works for truly column names, doesn't work for alias attributes, nested conditions, associations. To fix that, need to build new where clause first, and then get attribute names from new where clause.
16 lines
301 B
YAML
16 lines
301 B
YAML
david_modest_proposal:
|
|
name: A Modest Proposal
|
|
writer_type: Author
|
|
writer_id: David
|
|
category_id: General
|
|
author_id: David
|
|
|
|
mary_stay_home:
|
|
name: Stay Home
|
|
writer_type: Author
|
|
writer_id: Mary
|
|
|
|
steve_connecting_the_dots:
|
|
name: Connecting The Dots
|
|
writer_type: Man
|
|
writer_id: Steve
|