Rails on PostgreSQL: Rails 3, bundler, and the pg gem
Sep 17, 2010
Guyub adalah perusahaan TI berpusat di Palembang dengan fokus pada F/OSS Produk-produk >> Layanan-layanan >>
Aug 29, 2010
To this day I still hear people complain that Rails has poor documentation. From where I?m sitting this seems far from the truth. Let me lay out the evidence piece by piece: To learn Rails from scratch Michael Hartl recently finished his book Ruby on Rails Tutorial: Learn Rails by Example. The book teaches Rails 3 from the ground up and it?s available for FREE online. If you?d rather have a PDF or a book you can grab that as well (and he?s even working on some screencasts). The source for the finalized book will be pushed to GitHub and released under a Creative Commons License shortly after Rails 3 is done. If you?d like to help translate the book to your language of choice, feel free to contact Michael and he?ll get in touch when it?s time to make it happen. Rails Guides If you?re not a Rails newbie don?t forget about the Rails Guides, which have been updated for Rails 3. Rails API Docs There are two main websites I use to do API lookups. The first is Rails Searchable API Doc, which has online and offline searchable documentation. The second is APIdock which is online only, but has the ability to comment and easily compare different versions of documentation. Rails 3 Free Screencasts If you?re more of a visual learner (like me) then there are plenty of free screencasts to teach you about Rails 3. About 2 months ago I produced the Rails 3 Screencasts, which will get you started. Ryan Bates has also produced an incredible amount of Rails 3 screencasts over on Railscasts.com. Ryan has been producing Railscasts for over 3 1/2 years, isn?t that crazy? There?s also a few good free screencasts over on Teach me to Code by Charles Max Wood. Keeping on the Edge If you find yourself wondering how to keep up with all of the newest features / libraries for Rails 3, both the Ruby5 Podcast and the Ruby Show are going strong. Don?t listen to audio? It doesn?t matter, just subscribe to the Ruby5 RSS feed and get links with descriptions to all the newest libraries, tutorials, and more. You might also want to checkout Peter Cooper?s new Ruby Weekly, a Ruby email newsletter . Need to upgrade a big app to Rails 3? Jeremy McAnnaly?s Rails 3 Upgrade Handbook PDF is just $12. There?s also a few paid screencasts for the upgrade over on Thinkcode.tv and BDDCasts. Need a Book? There?s a bunch of books that will be coming out after the release, most of which you can start reading now. The Rails 3 Way by Obie Fernandez, Rails 3 In Action by Ryan Bigg and Yehuda Katz, Beginning Rails by Cloves Carneiro Jr and Rida Al Barazi, and of course the Agile Web Development with Rails:fourth edition by Sam Ruby, Dave Thomas, and David Heinemeier Hansson. In conclusion No more complaining about lack of good documentation! Seriously. If you want even more Rails 3 content, check out the blog post by Kevin Faustino on 34 Ruby on Rails 3 resources to get you started.
Aug 03, 2010
A while back I posted a link to a talk by Gleb Arshinov that he gave at the SF PUG. This talk was on “PostgreSQL for high performance Rails apps”, and was full of fine suggestions from their experiences with their Rails apps. Gleb is back again, this time on May 21 2010 at PGCon where he and Alexander Dymo talked about PostgreSQL as a secret weapon for Rails apps. Some of the same ground is covered (use SQL DDL vs ActiveRecord
Lots of good stuff there, enjoy!create_table, etc), but there’s lots of new information too. Here are some notes:
include to eliminate N+1 queries.acts_as_tree that reintroduce lots of queries in exchange for the improvement in abstraction.CASCADE since app won’t know about the deletionsselect option with PostgreSQL arrays to save on object creation. Questions from the audience about normalization vs efficiency.bool_or and GROUP BY to get the data in one fell swoop. Query time went from 2+ seconds to 64 ms.LIMIT and OFFSET when used with subselects. Some discussion of pagination with the audience. Here’s an excellent discussion of pagination alternatives written by Justin French.generate_series. Apparently these functions cannot generate hints for the planner.