← all posts

28 April 2010

by_star

It’s plugin / gem pimping time!

I started writing by_star back in November 2008 when Thomas Sinclair asked me if I could write a method that could find records for a given month. I was in my gem creating phase then so I created a gem called by_month and Thomas paid me for it (the sucker!).

Later on, I realised that by_month wasn’t good enough so I added a couple more finders to it. Then I added some more. Now you can find by all of these things:

So if you’re ever doing anything in your application where you need to find by dates / times, why are you not using by_star? Here’s a good reason you should be using by_star:

Before by_star

 Post.all(:conditions => ["created_at >= ? AND created_at <= ?", "01/01/#{Time.now.year}".to_time, "31/01/#{Time.now.year}"])

After by_star

Post.by_month(1)

This is only a taste of the shiny things in by_star! Use it!

— Ryan

Got a thought? Email me or find me on Mastodon.

Before this: rubyonrails.org is down

After this: Rails 3 Book: The Movie