blog.hasmanythrough.com Archives - 17 April 2014, Thursday

  • Symbols are not pretty strings

    blog.hasmanythrough.com 03 Nov '13, 7pm

    Symbols are one of the basic features of Ruby that give it that certain charm we all love. They aren't unique to Ruby (look at Smalltalk or Lisp), but they are a fundamental piece of the language. I'm not going to review what symbols are in this article since there are plenty of other...

  • gets :uniq

    blog.hasmanythrough.com 23 Oct '13, 2pm

    If you don't follow the Rails Trac commit log , you may find this interesting. Jeremy Kemper just checked in a change to enable the :uniq option for has_many :through associations. So what does the :uniq option do? The docs for the has_many options say: :uniq - if set to true, duplica...

  • count vs length vs size

    blog.hasmanythrough.com 27 Sep '13, 10am

    In Ruby, #length and #size are synonyms and both do the same thing: they tell you how many elements are in an array or hash. Technically #length is the method and #size is an alias to it. In ActiveRecord, there are several ways to find out how many records are in an association, and t...

  • Refactoring: be eager, not reckless

    blog.hasmanythrough.com 31 May '13, 12pm

    The illustrious Chris Eppstein recently tweeted : If some code should be refactored, stop what you are doing and refactor it. I was about to respond, but realized I had more to say than would fit in a tweet. (Waiting for someone to fix that problem!) (Then I got distracted and didn't ...

  • count vs length vs size

    blog.hasmanythrough.com 30 Jun '12, 10pm

    In Ruby, #length and #size are synonyms and both do the same thing: they tell you how many elements are in an array or hash. Technically #length is the method and #size is an alias to it. In ActiveRecord, there are several ways to find out how many records are in an association, and t...

  • A simple alternative to namespaced models

    blog.hasmanythrough.com 23 Jun '12, 1am

    A project I'm working on now is up to 57 model classes and is still growing. That's a lot of classes - welcome to domain modeling. In my opinion, the number of classes is a fair tradeoff that keeps each class simple enough to understand. In some ways it moves complexity out of the mod...

  • Agile git and the story branch pattern

    blog.hasmanythrough.com 30 May '12, 3pm

    The first thing this approach helps with is being able to make frequent commits without breaking the build or disrupting the work of teammates. Working with a centralized SCM system like Subversion can force you to choose between checkpointing your work and keeping the state of the pr...

  • How dynamic finders work

    blog.hasmanythrough.com 08 May '12, 5pm

    Dynamic finders work only with model attributes, not with associations. So if you have a belongs_to :user association on an article, you have to write Article.find_by_user_id(user.id) . I have an experimental patch that provides this functionality. I'm not entirely sure what to do wit...

  • Fifteen Protips for Conference Speakers

    blog.hasmanythrough.com 18 Apr '12, 2pm

    Do you dream of someday speaking at a technical conference? Have you spoken at a conference but felt like your journey to the podium wasn't as smooth as it might have been? Well here are a couple tips to make things go smoothly and endear you to your conference organizers. I'm writing...

  • has_many :through - Shifting to the client again

    blog.hasmanythrough.com 15 Mar '12, 11pm

    David, I agree it's heading there, but mostly the current rich client apps talk to custom web services. That is, you have to write code for both the client and the server. I expect there will be some standardization that lets the client code have all the custom logic. Think of a clien...

  • has_many :through - Yak Shaving

    blog.hasmanythrough.com 10 Mar '12, 4am

    As coders, most of us are not only familiar with the term yak shaving , but spend many of our days doing nothing but. I often struggle to explain to non-technical folks what I actually spend my time doing when I'm working and what it feels like. This is the most accessible explanation...

  • @xternal @jackdempsey my take on tech debt:

    has_many :through - Circle of death

    blog.hasmanythrough.com 21 Feb '12, 10pm

    Any advice on how to break the cycle? Reflecting on my own development experience, I think I need to be better at detecting when I need to stop and take a break, and when I need to motor on. Its not just fatigue - I do great work when fatigued, and also do crap work. Its a complex equ...

  • has_many :through - I heard you liked files

    blog.hasmanythrough.com 11 Feb '12, 10pm

    I was going to try and be clever and do a funny riff on this whole subject, but I just can't manage it. Here's the thing. Makefile was a dumb name for a file when Stuart Feldman wrote the make utility in 1977, but you have to forgive him because file systems were quite limited back th...