Cathy O'Connell's blog



Cathy O'ConnellCathy O'Connell
Standup NYC - CSS Image History
edit Posted by Cathy O'Connell on Thursday April 26, 2012 at 03:04PM

Interesting Things

Events This Week

Thursday:

Interesting Things

  • When you load objects through associations, you should be aware of how the objects are being loaded. If a where statement is used the calls are being translated to SQL and always hitting the database.

example

it "should whatever" do
      foo.bars.where(something: true).each { |bar|        bar.modify_something }
      foo.bars.each { |bar| bar.expect_something_to_be_modified }
end
  • This will fail as the first call is not only limiting the association but also loading different objects to the second foo.bars collection.

  • Choosing first on a has_many association is dangerous. There are two 'first' functions a class and an array one. Depending on whether the association is loaded, a different method is called.

example

it "should do something with the first element" do
    foo.bars.first.modify_something
    foo.bars(:force_load).first
end
  • To ensure loading occurs and thus the object is the same on every call, you can provide any value that evaluates to true as part of the association call. Here :force_load symbol, evaluates to true and forces a database load for bars.

Events This Week

Tuesday:

Thursday:

Cathy O'ConnellCathy O'Connell
NYC - 11/04/2011: Validating and Font face serving
edit Posted by Cathy O'Connell on Friday November 04, 2011 at 09:39AM

Interesting Things

  • Firefox can't alias a font face, unless the alias is the same place as the server.
  • Rails 3 includes a method to return all validators on an object eg:

Person.validators => []

Events

  • Handstand practice is becoming as important as stretches.

Cathy O'ConnellCathy O'Connell
Standup 11/03/2011: VIM news & IE is losing market share
edit Posted by Cathy O'Connell on Thursday November 03, 2011 at 03:07PM

Interesting Things

  • Internet Explorer is now below 50% market share.
  • VIM turned 20 - Happy Birthday VIM.
  • pgpool-II (version 3.2) - load balancer, failover support, replacement for using postgres directly.PGPOOL-II

Ask for Help

"How do I stub the base (super) class of an object using rspec?"

  • No answer yet. It was tested by confirming a method that the base method referenced was called. Solution welcome.

Events

Cathy O'ConnellCathy O'Connell
Standup 11/01/2011: Snowy Moeless, Weinre & Uniqueness
edit Posted by Cathy O'Connell on Tuesday November 01, 2011 at 09:16AM

Interesting Things

  • Weinre - WEb INspector REmote, a debugger for web pages designed to work remotely, nice weblet look. Allows you to debug web pages on phones.
    • Check it out (http://phonegap.github.com/weinre/) Thanks Micah
  • Moeless
  • Those strange looking people, are just moustache-less pivots. Support/join for the cause. Today is Day one.

Ask for Help

  • Rails Validates uniqueness allows nils. The database (psql and mysql) allows unlimited nils. *BUG - The app did not allow unlimited nulls. *Cause - The development structure had an allow nil false but the model file had allow nil true. This caused odd behaviour.

EVENTS

TUESDAY

  • 7pm Raise Cache - Project Management for Startups

WEDNESDAY

  • 6:30pm Node JS
  • 7pm Machine Learning

THURSDAY

  • 7pm Raise Cache