Warning: Creating default object from empty value in /homepages/39/d161420129/htdocs/p373.net/wp/wp-content/themes/p373b/admin/functions.php on line 183
Tag Archives: rails

Stub a ruby method and conditionally raise an exception based upon state of object

(If you want to skip my fancy and hilarious writing, skip straight to the SO post) Here’s the use case: You’re building  a mass email system for your globo-mega-corp’s 90,000 employees.  Your corp’s smtp server can only handle batches of 450 recipients at a time.  Your boss tells you your corp’s SMTP server is finicky […]

Posted in Coding, Ruby/Rails, Technology | Also tagged , | Comments closed

Carrierwave custom validations

The use case here is when you need to conditionally validate the extensions you validate.  In our case, we only wanted to validate the extension white list when a local file was uploaded.  This is because our users can signup via Yammer during which we suck in their mugshot images.  Yammer’s mugshot urls do not […]

Posted in Coding, Ruby/Rails, Technology | Also tagged | Comments closed

Rails deployments from 4 minutes to 40 seconds

Currently my deployment(which is pretty close to a default setup) takes about 4 minutes.  Currently we take the server offline into a “maintenance” mode for the entire deployment process.  That’s 4 minutes of downtime.  No bueno. Here’s what we’re going to do: 1. Move the maintenance mode (think of it like a mutex) to wrap […]

Posted in Coding, Ruby/Rails, Technology | Also tagged , , | Comments closed

Patterns: Exception Factory(or is it a Proxy?)

Let’s say you are writing a library that wraps around an API, say Yammer.  Your library probably uses a lower level library to manage the http requests, say Faraday.  There are a multitude of problems that may arise while communicating with their api.  For example, the user could have revoked their token, or there could […]

Posted in Coding, Ruby/Rails, Technology | Also tagged , | Comments closed