Instantiating objects with blocks in Ruby – HipsterStruct
Blog post about implementation of such syntax:
user = User.create! do
name 'Snow king'
end
http://gistflow.com/posts/554-hipsterstruct-new-way-for-creating-objects-in-rails
Written by Anatoli Makarevich
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#