Compare projects
Project comparisons allow you to view any selection of projects side by side just like they're shown on regular categories or in search results. You can try out an example or start yourself by adding a library to the comparison via the input below. You can also easily share your current comparison with others by sending the URL of the current page.
0.0
The plugin is really rather simple; here's the ignore_nil method:
def ignore_nil(&block)
begin
yield
rescue NoMethodError, RuntimeError => e
if (e.message =~ /You have a nil object when you didn't expect it/) ||
(e.message =~ /undefined method `.*?' for nil:NilClass/) || (e.message =~ /^Called id for nil/)
return nil
else
raise e
end
end
end
What's interesting about this is it catches both NoMethodError and RuntimeError, both of which
can occur if a method unexpectedly returned nil and you called a method on it, but *ONLY* if
the error message matches! This means legitimate NoMethodError and RuntimeError messages will
not be bothered by ignore_nil, and will still raise in your application as you expect.
I've used this in a production application since about mid/late 2008, I'd consider it very stable.
Feedback welcome!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026