Tag Archives: rubyonrails
Simple Quarter Select – Rails plugin for Q1,Q2,Q3,Q4 selector
Have you ever wanted a select component for Quaters of the Fiscal Year (Q1,Q2,Q3,Q4)? The Simple Quarter Select Ruby on Rails plugin does it for you. It’s highly configurable and maps to the month of any datetime attribute in your model.
Why map the quarter to a datetime attribute?
I think the answer is obvious but [...]
Converting Table Data to YAML for Testing in Ruby on Rails
One of my clients has a huge application with no test suite. I am helping the company migrate to Rails 2.3 as well as remove some bottlenecks from their code. I needed to convert around 10 look-up tables to YAML’s so that I could load the data as fixtures and test the application [...]
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 Also tagged active-record, Ruby On Rails, skipping-validations, validations Comments closed
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 [...]
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 [...]

Rails Authentication with Devise and CanCan part 2 – Restful Resources for Administrators