Author Archives: gabe
How to Get Dropbox to Backup Files in Other Directories on Windows
If you’re using Dropbox (affiliate link), and you should be, because it’s awesome, you might have noticed that Dropbox will only backup/sync files inside your drop box folder; you can’t tell Dropbox to also sync with other folders. Now, if … Continue reading
Rails Gotcha: ActiveRecord Caches Associated Records by Default
ActiveRecord will cache the results of association method calls by default, unless you tell it not to. (This applies to Rails 2.3.2 and perhaps earlier versions.) From the documentation: project.milestones # fetches milestones from the database project.milestones.size # uses the … Continue reading
Using assert_select to find an attribute that has square brackets in the value
Problem: assert_select ‘input[name=model_name[field_name]]’ gives ArgumentError: Invalid selector: ] Solution: assert_select ‘input[name=?]‘, ‘model_name[field_name]‘ Thanks to the Boston Ruby Group thread for the answer. Bonus: Here’s a helpful assert_select cheat sheet.
InvalidAuthenticityToken, Forms, Tables, and Rails
Recently, while pairing with Abel as we hacked on some code for his budget tracking app, we came across an interesting problem while trying to acomplish what seems like a pretty straightforward task.
Better Rails Searching with Named Scopes using Scope Builder
When it comes writing elegant search code in a Rails app, Named Scopes immediately come to mind. And for good reason: they’re a fantastic way to express, well, scopes, for your searches. In your Person model, you might have named … Continue reading
Resolving the CodeSign error in Xcode when building new iPhone projects
Quick tip: if you’re just getting started with iPhone app development and trying to build and run an iPhone app project using the iPhone simulator in Xcode and you’re getting an error that looks like: CodeSign error: Code Signing Identity … Continue reading
Don’t try to be smarter than ActiveRecord
When you’re writing conditions for a finder in ActiveRecord, and you want to use an array of values for a sql in() statement, you might think to help ActiveRecord out and comma-separate the array values like this: type_ids = [1, … Continue reading