RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Rails adds #excluding to ActiveRecord::Relation

Rails adds #excluding method for an ActiveRecord::Relation to exclude the specified record (or collection of records) from the resulting relation.

This method is a short-hand for ActiveRecord’s where.not introduced in Rails 4.0.

Read the full blog post: https://blog.saeloun.com/2021/03/08/rails-6-1-adds-excluding-to-active-record-relation

Comments

Rails adds #excluding method for an ActiveRecord::Relation to exclude the specified record (or collection of records) from the resulting relation.

This method is a short-hand for ActiveRecord’s where.not introduced in Rails 4.0.

I’d like to see #excluding as an ActiveSupport extension on hashes/arrays.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in