Skip to content

Instantly share code, notes, and snippets.

@steverob
Created July 28, 2016 16:50
Show Gist options
  • Save steverob/19c7d58c7da6062adbed5d0fddd0ee1f to your computer and use it in GitHub Desktop.
Save steverob/19c7d58c7da6062adbed5d0fddd0ee1f to your computer and use it in GitHub Desktop.
Ambiguous field exception in AR
class Foo
has_many :bazs
has_many :bars, through: :bazs
end
class Baz
belongs_to :foo
has_many :bars
end
class Bar
default_scope -> { order('created_at DESC') }
belongs_to :baz
end
#
foo.bars.update_all attribute: 'new_value'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment