Joe Moore's blog
Standup 11/21/2008: Pro Bono Airwaves
Interesting Things
- Rails reminder:
flash[:notice] = "Good Job"will survive a redirect, whileflash.now[:notice] = "Good Job"will not. In general,flash.nowis used when you render a template without a redirect, such as when a form submit has validation errors. - Good Books: Several folks have recommended JavaScript: The Good Parts.
- Pro bono: Would anyone like to help out KUSF for free? Their new website project has been stalled for a year.
Ask for Help
"How do you get Selenium to work with Firefox 3?"
If you know how, pull the jar files out of a later release and use those. Good luck!
Standup 11/20/2008: Engine Yard ssh key changes
Interesting Things
Engine Yard has made some changes to their ssh-key setup:
...any non-approved keys will be removed from the root user's authorized_keys file. It should be noted that customers should not log in directly as root but rather should log in as their user and use sudo for any commands that need super user privilege. If you are currently using the root user to log in and have your key in roots authorized_keys file it will be removed when this change is made.
If you are having any ssh problems, contact them.
Standup 11/18/2008: Unbelievable has_many :through Gotcha
One team discovered a jaw-dropping issue with has_many :through. Given the following:
class User < ActiveRecord::Base has_many :user_photos has_many :photos, :through => :user_photosa_user.photos.createwill create and persist both a Photo object and the UserPhoto join objectphoto = a_user.photos.buildfollowed byphoto.savewill create and persist the Photo object only, and will not persist an appropriate UserPhoto join object.
Rails 2.2:
Test::Unit::TestCaseextentions have been removed from Rails Core and are now inActiveSupport::TestCase. As stated in the Groups Thread about this, useActiveSupport::TestCaseinstead ofTest::Unit::TestCasein test/test_helper.rb.
Standup 11/17/2008: Google Chrome Gotchas
Interesting Things
We recently updated Pivotal Tracker's extensive JSUnit test suite to be compatible with the Google Chrome browser. Check out the extensive Notes on Google Chrome Compatiblity post by Pivot Chad.
ActiveScaffold + Rails 2.2 = BOOM. ActiveScaffold will work with Rails 2.1 if you get the version from github. Read about it.
- Rails 2.2 + Rspec 1.11 = FAIL
Standup 11/07/2008: Selenium for Flash
Interesting Things
- Teaser: Selenium for Flash! We've developed a Selenium-like framework for Flash. It's pre-alpha, and needs to be extracted from it's current home inside a project. Are you interested in a Selenium-like framework for Flash, or have you written one yourself? Let us know!
STI-weirdness. Rails surprise of the day: given a query of a
has_many :photoswhere Photos has STI subclasses (got that?) Rails will build a SQL query that includes the subclass types of Photo, which you might not want:foo.photos.find_by_type("Photo") # query will have "... WHERE type IN ('Photo', 'OriginalPhoto', 'ThumbnailPhoto')"It appears that the retardase_inhibitor might not work with Rails 2.1.X due to fixes in ActionMailer.
- JetBrains has been hard at work: they have released both a new Ruby plugin for IntelliJ, and a ruby-specific IDE (based on IntelliJ) named RubyMine.
Check out Pivot Jonathan's wife's art exhibit at Artist-Xchange Gallery in San Francisco, Friday 11/7 from 7-10pm:
Ask for Help
"I want to create a custom launcher for Firefox 2 and Firefox 3 with different profiles. Perhaps the real question is how do we create a custom version of a Mac application launcher, passing in the arguments we need?"
... without having to invoke it on the command line every time.
"We're trying to delete cookies in our Controller, but they keep appearing in the headers anyway."
Suggestion: make sure you are specifying your URL paths and domains correctly.
"Why won't our CSS and other assets load the first time when accessing an SSL-protected domain on Engine Yard?"
It's most likely not Engine Yard or Firefox 3's fault. More research needed.
Standup... and VOTE!
Interesting Things
- It's election day! If you are taking the time to read this geeky blog, you better have voted!
Ask for Help
"Is there some order-dependency issue with `has_many_polymorphs?"
We have a test that passes in isolation, but fails when the whole file is run.
"Any advice to setting up Lucine to allow us to search for strings with special characters, such as '-', without having to wrap them in quotes?"
We have some Lucine knowledge here but feel free to give us your suggestions as well.
Standup 10/20/2008: Preventing Flash from Reloading
Interesting Things
- We discovered why a Flash widget was reloading itself: changes the CSS
positionvalue. We were hiding the Flash widget by moving it's containingdivoff the page withposition: absolute; left: -9000, and removing the class that had those values to show it again. It turns out that changing thatpositionvalue causes the Flash to reload. By keeping theposition:absolutesetting when we both show and hide our container div, the Flash no longer reloads.
Ask for Help
"When using Rails's date_select helper, is there a corresponding helper method to turn that date format into a Date object in the controller?"
Some Snippets are available, but how about a Rails built-in solution?
Standup 10/15/2008: this_method; dynamically creating tables for testing
- Where am I? -- Ever need to find the name of the method you are currently within? Here's a
this_methodmethod! The magic is in the REGEX, of course.
module Kernel
private
def this_method
caller[0] =~ /`([^']*)'/ and $1
end
end
- One project wanted to test a very ActiveRecord-specific Module in an isolated, generic way. After spending time researching techniques of mocking and stubbing the many, many ActiveRecord methods that would be touched, they decided to just dynamically create an ActiveRecord and a DB Table for it on the fly! They even used single table inheritance (STI)
describe "MyMagicModule Mixin" do
before(:all) do
ActiveRecord::Base.connection.create_table "some_base_models",
:force => true do |t|
t.string "name"
t.string "type"
t.integer "some_model_b_id", :limit => 11
end
end
after(:all) do
ActiveRecord::Base.connection.drop_table "some_base_models"
end
class SomeBaseModel < ActiveRecord::Base;end
class SomeModelA < SomeBaseModel
include MyMagicModule
belongs_to: :some_model_b
end
class SomeModelB < SomeBaseModel
include MyMagicModule
end
it 'should use special belongs_to stuff from MyMagicModule' do
model_a = SomeModelA.create!(
:name=> "Model A",
:some_model_be => SomeModelB.create!(:name => "Model B"))
# test the functionality from MyMagicModule
end
end
Standup 10/9/2008: IE 6 Alpha Transparency Fixes?
Ask For Help
Once again, a project is asking for everyone's favorite IE 6 .PNG alpha transparency fixes -- more rounded corners! Examples include the CSS Behavior code, using .PNGs or .GIFs with on/off transparency, regulating IE 6 to the square Web 1.0 world, and even using on/off transparency and just knocking a pixel or two off of corners for a "good enough" rounded look.
What are your favorite IE 6 rounded-corner and/or alpha-transparency fixes?
Standup 9/17/2008: IE is so Web 1.0
Interesting Things
One client decided that Web 2.0-style rounded corners are only needed in Firefox and Webkit-based browsers because they are "free" with CSS properties built in for those rendering engines: -moz-border-radius and -webkit-border-radius. Internet Explorer is going to be left in the 1.0 world, at least for now, due to the over head of managing rounded corners.
Feel free to promote your personal favorite rounded corner techniques in the comments.








