Devchat.tv Episode Roundup

Devchat.tv Episode Roundup

Download on the App Store

All Devchat.tv Episode Roundup episodes

  • ActiveModel Callbacks
    In the Jots (like tweets) in JotRod, I needed to generate a hash on creation as the key for the Jots. So, I determined that the easiest way to do that was to include ActiveModel Callbacks.
    The module is pretty simple to add to your classes. Here's a demo of how to add it to Sandra.
    Sandra's repository
    JotRod's repository
    Download 223 MB
    Download (iPod & iPhone) 37 MB
    Take the 2011 Readers Survey
    0 min
  • ActiveModel Callbacks
    In the Jots (like tweets) in JotRod, I needed to generate a hash on creation as the key for the Jots. So, I determined that the easiest way to do that was to include ActiveModel Callbacks.
    The module is pretty simple to add to your classes. Here's a demo of how to add it to Sandra.
    Sandra's repository
    JotRod's repository
    Download 223 MB
    Download (iPod & iPhone) 37 MB
    Take the 2011 Readers Survey
    0 min
  • ActiveModel Callbacks
    In the Jots (like tweets) in JotRod, I needed to generate a hash on creation as the key for the Jots. So, I determined that the easiest way to do that was to include ActiveModel Callbacks.
    The module is pretty simple to add to your classes. Here's a demo of how to add it to Sandra.
    Sandra's repository
    JotRod's repository
    Download 223 MB
    Download (iPod & iPhone) 37 MB
    Take the 2011 Readers Survey
    0 min
  • 026 RC Counter Caches
    A counter cache is a handy way to speed up queries where you only need the number of an associated model rather than the entire collection. In your code, you might see something like this:
    @post.comments.count
    When you run this code, you wind up with another query to the database to get that number. That's not a big deal until you have that count being called for each post in your stream. To avoid this, you can use a counter cache.
    To use the counter cache, add a _count to the primary model's table. In this example, it would be called "comments_count".
    class AddCounterCacheToPosts < ActiveRecord::Migration
    def change
    add_column :posts, :counter_cache, :integer
    end
    end
    With that migration in place, all you need to do from there is add :counter_cache => true to your other model—in this case Comment.
    class Comment < ActiveRecord::Base
    belongs_to :post, :counter_cache => true
    end
    Now, whenever you create or delete a new comment for a post, it'll update that counter_cache column on the posts table.
    A few things to keep in mind are:
    If you're adding this to an existing system, you'll probably have to add a data migration to set the counts.
    This number is not checked each time it's changed, so if you change the number, you'll get results in the future relative to that number.
    6 min
  • 073 TMTC Grant Ingersoll – Lucene & Solr

    Lucene is a terrific tool for powering searches. Solr adds a layer of functionality on top of it that makes things even more easy to use.

    In this interview, Grant and I discuss the ins and outs of using Lucene to power searches on your websites.

    1 hr
  • Model Generator
    Here's an introduction to creating a Rails connector gem for an ORM with a model generator.
    Download 352.3 MB
    Download (iPod & iPhone) 84.7 MB
    Take the 2011 Readers Survey
    0 min
  • Model Generator
    Here's an introduction to creating a Rails connector gem for an ORM with a model generator.
    Download 352.3 MB
    Download (iPod & iPhone) 84.7 MB
    Take the 2011 Readers Survey
    0 min