When I recently used Transmit (4.1.7) to upload Rails assets to Amazon S3 I ran into an issue where the CSS files were being loaded, but the styles weren’t being applied. Attempting to access the CSS directly would download the file instead of displaying it in the browser.
A quick check on Google led me to the answer – S3 was returning the wrong content-type headers.
Transmit actually has a feature for this, go to Preferences > Cloud and you can customize headers by file type. I added Extension: css, Name: content-type, Value: text/css and re-uploaded my CSS files (then set the permissions to Read: World) and the styles are now being parsed correctly.
I started freelancing full-time at the end of 2007, and for the past ~3 years I’ve managed to make a living without doing any marketing, relying strictly on repeat business and word of mouth referrals.
Now that I’ve reached a point where I know I need to attract clients more specifically to match up with my adapting skill set, I’ve found myself rethinking just about every part of my own “brand”.
Repositioning myself in order to be considered for more Ruby on Rails start up ventures will be my focus this Summer, and getting back into writing articles on the web (some people call it blogging) will be a part of the process.
Here we go.
I recently had need for a simple referral tracking mechanism in a Rails application, what we used to refer to as promo codes at AOL. Here’s the method I chose for implementation.
In my application controller I’m capturing any ‘referral’ variable in the url as a session variable of the same name.
before_filter :capture_referal
private
def capture_referal
session[:referral] = params[:referral] if params[:referral]
end
This just writes a session variable called referral with the value passed in the url. Later, during checkout/registration I’m capturing the session variable as part of the order.
@order.referral_code = session[:referral]
@order.save
Lots of ways to make this fancier, but I love the simplicity of it. Referral codes can be generated for any affiliate by any of the sales and marketing staff, and there’s no need to set them up in advance. Regular order reports will show the code and allow searching for a specific code