<commit_before>:O
===

In [Rails](http://api.rubyonrails.org/classes/ActiveRecord/NamedScope/ClassMethods.html):

		class Foo < ActiveRecord
			named_scope :bars, :conditions => { :bar => true }
		end
		
		Foo.all
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.bars.all
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.all.bars
			=> NoMethodError: undefined method `bars' for #<Array:0x64b6d28>
			
And also:

		Foo.find(1533, ...)
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.bars.find(1533, ...)
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.find(1533, ...).bars
			=> NoMethodError: undefined method `bars' for #<Array:0x64b6d28>

So:

		class Foo < ActiveRecord
			named_scope :bars, :conditions => { :bar => true }
			named_scope :yall, lambda {|*args|
		    args.first || {}
		  }
			named_scope :these, lambda {|*ids|
				{:conditions => {:id => ids}}
			}
		end

		Foo.yall
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.bars.yall
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.yall.bars
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.these(1533, ...)
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.bars.these(1533, ...)
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.these(1533, ...).bars
			=> [ #<Foo id: 1533, ... >, ... ]<commit_msg>little bit country<commit_after>:O
===

In [Rails](http://api.rubyonrails.org/classes/ActiveRecord/NamedScope/ClassMethods.html):

		class Foo < ActiveRecord
			named_scope :bars, :conditions => { :bar => true }
		end
		
		Foo.all
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.bars.all
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.all.bars
			=> NoMethodError: undefined method `bars' for #<Array:0x64b6d28>
			
And also:

		Foo.find(1533, ...)
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.bars.find(1533, ...)
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.find(1533, ...).bars
			=> NoMethodError: undefined method `bars' for #<Array:0x64b6d28>

So:

		class Foo < ActiveRecord
			named_scope :bars, :conditions => { :bar => true }
			named_scope :yall, lambda {|*ids|
				{:conditions => {:id => ids}}
			}
			named_scope :all_yall, lambda {|*args|
		    args.first || {}
		  }
		end

		Foo.yall(1533, ...)
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.bars.yall(1533, ...)
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.yall(1533, ...).bars
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.all_yall
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.bars.all_yall
			=> [ #<Foo id: 1533, ... >, ... ]
		Foo.all_yall.bars
			=> [ #<Foo id: 1533, ... >, ... ]

That is all.

---

Subscribe to [new posts and daily links](http://feeds.feedburner.com/raganwald "raganwald's rss feed"): <a href="http://feeds.feedburner.com/raganwald"><img src="http://feeds.feedburner.com/~fc/raganwald?bg=&amp;fg=&amp;anim=" height="26" width="88" style="border:0" alt="" align="top"/></a>

Reg Braithwaite: [Home Page](http://reginald.braythwayt.com), [CV](http://reginald.braythwayt.com/RegBraithwaiteGH0109_en_US.pdf ""), [Twitter](http://twitter.com/raganwald)
{'fraction_non_alphanumeric': 0.2465846994535519, 'fraction_numerical': 0.054986338797814206, 'mean_word_length': 2.421728971962617, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 66, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5489913', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1174, 'n_words': 213}