Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

[Standup][Boulder] 9/11/2012: I’m sick with your Errors

Austin Vance
Tuesday, September 11, 2012

Interesting

  • ActiveRecord::Base#clone and ActiveRecord::Base#dup will hold reference to the same ActiveModel::Errors. This will create situations where running valid on one record will add errors to both.
class Dog < ActiveRecord::Base
  validates_presence_of :ball
end

fido = Dog.new
fido.valid?

rex = fido.dup
rex.ball = "tennis"
fido.valid?

fido.errors.empty? == false

Events

Ruby Group Tonight @ 6:30

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][Boulder] 9/10/2012: Net::Http left me hangin’

Austin Vance
Monday, September 10, 2012

Interesting

  • If you would like to return a value from an ensure block you must explicitly return it

  • Net::Http#request does not leave a tcp connection open unless one is already started before calling request.

  • To make a BigInt in with a migration (at least with postgres) use limit: 8, anything higher will be ignored and a regular Int will be created

  • To make a BigInt in with a migration (at least with postgres) use limit: 8, anything higher will be ignored and a regular Int will be created

Events

  • Boulder Ruby Group @ Pivotal Boulder: tomorrow 7pm
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][Boulder] 09/06/2012: If nothings going on call me.

Austin Vance
Thursday, September 6, 2012

Interesting

  • action_dispatch.show_exceptions = true will show exceptions in test.log for server exceptions with capybara.

  • Don’t stub object under test… it is normally bad.

  • Enumerable#Detect will take a proc/lambda and call it if nothing is found. The same is true for Enumerable#find.

Events

  • Ruby group meet up next Tuesday.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][Boulder] 9/5/12 – Don’t judge before you typecast

Austin Vance
Wednesday, September 5, 2012

Helps

  • What is the fastest way to use a calculated column in a where clause with postgres?
SELECT (column1 + column2) AS super_column WHERE super_column > 1

Solutions:

  • use a sub query in the FROM
  • duplicate the logic for the calculated column

Like Woah

  • _before_type_cast lets you get to attributes of a model before they are type cast, useful for validations and calculations.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][Boulder] 8/21/12: Keep your brews fresh.

Austin Vance
Tuesday, August 28, 2012

Helps

  • Installing postgres modules… We would like to use pg_trgrm and are looking for pointers and pain points installing pg_modules on dev and production systems. Anything will help.

Interestings

  • Remember to update your homebrew brew update to get new packages
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][Boulder] 8/27/12: What week is it again?

Austin Vance
Monday, August 27, 2012

Helps

  • Any tips for reading HttpPerf?

  • LogReplay, any good gems or tips to replay requests from server logs?

Interestings

  • Jeff dean mentioned some strategies dealing with week based reporting, and the oddities that arise when week 0 bleeds into the next year.

    Use Date#strf_time

  Week number:
  The week 1 of YYYY starts with a Sunday or Monday (according to %U
  or %W).  The days in the year before the first week are in week 0.
    %U - Week number of the year.  The week starts with Sunday.  (00..53)
    %W - Week number of the year.  The week starts with Monday.  (00..53)
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][Boulder] 08/23/12: Move a little down and to the right

Austin Vance
Thursday, August 23, 2012

Interestings

  • Active Record Calculations are Not scoped, be aware.

  • puts "v" is a newline and a tab character, for all your ascii art apps.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][Boulder] 08/21/12: Wanna redo the repeater?

Austin Vance
Tuesday, August 21, 2012

Helps

  • Does anyone have any tips to get the Rails source running with all the ActiveRecord tests painlessly?

Interestings

  • rake db:migrate:redo does not generate a schema.rb so if you want your schema to reflect your current database rake db:migrate:redo db:schema:dump
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][Boulder] 08/20/12: MailCatcher in the Rye

Austin Vance
Monday, August 20, 2012

Helps

  • Rails runs very slowly on a brand new MacbookPro, something like 5 seconds to load the welcome to rails page. This happens when using Thin and WeBrick.

Hmm…

Interestings

  • jQuery $.each acts like Ruby’s Object#tap.

  • Rails model.has_many_association.pluck will not scope to the model, it will just return the result of a SQL query for the attribute of the association’s model. It will also not use any in memory objects are in the association but not in the database. So, be weary and use map.

  • MailCatcher is a gem that will catch all email sent from your app so you don’t have to remember and create a bunch of unique emails. It also makes email debugging a snap.

  • jQuery pseudo selector :input will select all elements that can take a value. Useful for grabbing inputs and clearing forms.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Austin Vance

Austin Vance
Boulder

Subscribe to Austin's Feed

Author Topics

  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >