Author Archives: Tony
Getting jQuery, Rails, and Authenticity Tokens to play nice
For anyone that uses the jQuery AJAX library to send POST requests to their Rails application, you have probably found that the built in Rails CSRF protection does not play nice with your jQuery POST requests. By the way, if you don’t know what CSRF is, check out my Ruby on Rails security presentation. [...]
Ruby on Rails – Skipping validations based on where object is created
I ran into an issue today where I wanted to skip validations based on where an object was created. To be more specific, I wanted to validate strictly if a “venue” was created through my web interface but I want to skip validations when importing venues. The reasoning is pretty simple, I want [...]
Posted in Software Tagged active-record, Ruby On Rails, rubyonrails, skipping-validations, validations 6 Comments
Back links for your Ruby on Rails application
Here is a nice little helper I wrote to display back links:
def back_link
link_to "« Go Back", request.env["HTTP_REFERER"].blank? ? "/" : request.env["HTTP_REFERER"]
end
If you just use the HTTP_REFERER without checking if it’s blank, weird things can happen if someone lands on your page from an email, for example.
If you enjoyed this post, make [...]
Free Market Research Methods Part 1 – Analyzing Public Filings
Last week I attended a Market Research workshop presented by Dr. Dean Chang, Director of Mtech Ventures and Education. Instead of the general advice given at many market research presentations, Dr. Chang put himself in the shoes of a founder and walked us through some motions. This article will cover his take on analyzing public [...]
Posted in marketing Tagged business, market-research, market-research-methods, marketing, SEC 2 Comments
Where is my crontab located on Mac OS X 10.5 Leopard?
I googled around for a few minutes with no luck. After probing around my system, here is where I found my crontab file:
Macintosh-2:mls TAmoyal$ sudo ls /usr/lib/cron/tabs/
Password:
TAmoyal
I found it by checking the crontab man page:
man crontab
Where I saw a “FILES” section:
FILES
/usr/lib/cron/cron.allow
/usr/lib/cron/cron.deny
And that lead me [...]
Interning empty string error in Ruby on Rails
I don’t like writing short posts about fixing code errors but I think this one deserves a quick shout out. If you get an error in your Rails application that says “interning empty string”, there could be something wrong with an error message in your validations. For example, I had something like:
def geocoding_works_when_geotarget_is_true
[...]
Logging your Rails model (the easy way)
In one of my Rails applications, I have some pretty heavy tasks in my models. I decided to log to different files for two of my models so that I can easily make sure these tasks are performed correctly without going through my application log. I also call some of my model methods [...]
Validating multiple fields with one validator in Flex3
I like laying out forms in MXML because it’s easy to read. In a recent project, I had five email fields and it looked something like this:
<mx:Form id="myForm">
<mx:FormItem label="1." labelStyleName="tenEmailsLabel">
<mx:TextInput id="email1" width="300" fontSize="13" />
</mx:FormItem>
<mx:FormItem label="2." labelStyleName="tenEmailsLabel">
<mx:TextInput id="email2" width="300" fontSize="13" />
</mx:FormItem>
<mx:FormItem label="3." labelStyleName="tenEmailsLabel">
<mx:TextInput id="email3" width="300" fontSize="13" />
</mx:FormItem>
<mx:FormItem label="4." labelStyleName="tenEmailsLabel">
[...]
Configuring Phusion Passenger on a 256MB Ubuntu Slice @Slicehost
I installed Phusion Passenger a few weeks ago to get a production environment up and running for my Rails app. It was super easy to install and felt like magic. I checked off the item on my TODO and moved on. After all it didn’t say “YOUR APP WILL BE SLOW AS [...]


Converting Table Data to YAML for Testing in Ruby on Rails