19 Mar '12, 2pm

and that's why you always use parentheses!

and that's why you always use parentheses!

March 19, 2012 Tagged: ruby shoulda Comments (View) Do End Your Braces Braces and do /end are completely swappable—almost all the time. They have different precedence. It’s not often that anyone comes across what this means in practice. In shoulda, these do different things: should redirect_to('#edit') { article_edit_path(@article) } should redirect_to('#edit') do article_edit_path(@article) end To get a better grasp on the differences, consider these two simple methods: def outer(inner, &block) inner block.call('outer') if block_given? end def inner(&block) block.call('inner') if block_given? 1 end Here outer is analogous to should and inner to redirect_to . Instead of having any real logic, though, they call a block with what they are. In practice: outer inner {|where| puts "#{where} called me"} # "inner called me" outer inner do |where| puts "#{where} called me" end # "...

Full article: http://robots.thoughtbot.com/post/19571992929/do-end-your...

Tweets

How did I end up with this hairstyle??? (#travel)

How did I end up with this hairstyle??? (#travel)

kyspeaks.com 18 Mar '12, 4pm

How did I end up with this hairstyle??? So I was having my haircut at the usual place that I’ve been visiting for the past...

Paper will always have its uses

monocle.com 19 Mar '12, 11am

Last week, the Encyclopaedia Britannica announced that it would no longer publish a print edition. Across many industries ...

Use PPC to Enhance Your SEO: Sure, pay per clic...

promotionworld.com 19 Mar '12, 9am

Sure, pay per click advertising (PPC) and search engine optimization (SEO) offer different means to the same end (to get y...

A use of Enumerable#chunk

blog.segment7.net 16 Mar '12, 11pm

drbrain | Fri, 16 Mar 2012 23:19:07 GMT Posted in Ruby In Ruby 1.9, Enumerable has a few new methods including Enumerable#...

Now We Know: Decriminalization DOES Cut Drug Use [VIDEO] | Care2 Causes

Now We Know: Decriminalization DOES Cut Drug Us...

care2.com 18 Mar '12, 8pm

Ten years ago, Portugal took the unprecedented step of decriminalizing all drugs . One decade after this much derided expe...

More fluid is always better for runners: is this really true? #running

More fluid is always better for runners: is thi...

runaddicts.net 20 Mar '12, 10pm

Interested in writing for RunAddicts.net? Get started now! Hydration recommendations have been running into controversies ...

WHO Chief: The End of Modern Medicine Is Coming | Care2 Causes

WHO Chief: The End of Modern Medicine Is Coming...

care2.com 17 Mar '12, 7am

What would the world look like if an injury from a minor infection could kill you? Where bacterial illnesses like strep ha...

Agency Use of New Media, and More from CRS: Som...

fas.org 19 Mar '12, 12pm

« US Soldiers Are Immune from Afghan Prosecution, CRS Says Nozette Was Manipulated by FBI, His Attorneys Say » Agency Use ...

Four Resources for Re-selling Your High-End Clothing Online

Four Resources for Re-selling Your High-End Clo...

feelgoodstyle.com 13 Mar '12, 4pm

Ever wonder if there’s a place for your second hand clothing that doesn’t require you to pile your clothing in a bag, and ...

Renesas Electronics Introduces High-Performance...

design-reuse.com 19 Mar '12, 7am

(1) The industry's highest level of CPU and 3D graphics processing performance in a STB product By adopting the dual-core ...

End of Days - Haute Living

End of Days - Haute Living

hauteliving.com 17 Mar '12, 10pm

Captain Winsor Annual Calendar Chronograph Westime Limited Edition Zenith has a rich history of creating watches for explo...

How to… grow and use herbs

How to… grow and use herbs

theecologist.org 09 Mar '12, 10am

Herbs can make all the difference to food, and it is not overstating the case to say that they define it; cuisines are cha...

4 Creative Ways to Use the New Facebook Brand Pages

4 Creative Ways to Use the New Facebook Brand P...

searchenginewatch.com 15 Mar '12, 1pm

Facebook is scheduled to fully switch over all Facebook brand pages to the new Timeline look and feel at the end of March....

Digital Defenders: Tribal People Use GPS to Protect Their Lands

Digital Defenders: Tribal People Use GPS to Pro...

e360.yale.edu 15 Mar '12, 12pm

Digital Defenders: Tribal People Use GPS to Protect Their Lands From the rainforests of central Africa to the Australian o...

Dolphin Shows Might End in Switzerland

Dolphin Shows Might End in Switzerland

care2.com 19 Mar '12, 2am

Coming after the good news a captive dolphin in South Korea will be released back into the ocean, is an even better develo...