Header_image
Jeremy Walker

Software Developer & Social Entrepreneur

A scope for returning no records in ActiveRecord

Update: A version by xuanxu has now been accepted into Rails core.

I've added a scope for .none which returns no records and skips the database. Check out my pull request on rails master - any thoughts or improvements are welcome!

Credit to xuanxu for the idea.

Share This Post

Comments

No-one has posted a comment yet. Be the first!

Post a Comment

I'd love to hear your thoughts :)