19 Apr '13, 10pm

{:foo => "bar", :fizz => "buzz"}.except(:baz) check out Hash#except (RoR only)

# File activesupport/lib/active_support/json/encoding.rb, line 239 def encode_json (encoder ) # values are encoded with use_options = false, because we don't want hash representations from ActiveModel to be # processed once again with as_json with options, as this could cause unexpected results (i.e. missing fields); # on the other hand, we need to run as_json on the elements, because the model representation may contain fields # like Time/Date in their original (not jsonified) form, etc. "{#{map { |k,v| "#{encoder.encode(k.to_s)}:#{encoder.encode(v, false)}" } * ','}}"

Full article: http://api.rubyonrails.org/classes/Hash.html#method-i-except

Tweets

Hash.[] - @UnfalseIdeas #ruby

apidock.com 17 Apr '13, 7am

populated with the given objects. Equivalent to the literal { key => value, … }. In the first form, keys and values occur ...