Tag Archives: rails
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 [...]
Posted in Software Also tagged database, rake, rubyonrails, tasks, testing, utilities, yaml Leave a comment
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 [...]
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 [...]
Defending Against Attacks With Rails
A couple weeks ago I presented on Rails security at a local Ruby On Rails meetup. I finally got around to posting the slides online.
The presentation covers topics including authentication, hashing, salting, key stretching, white listing, session hijacking, replay attacks, session fixation, cross-site request forgery, cross site scripting, sql injections, other injections, and some [...]
Simple Time Select for Ruby On Rails Just Got Simpler
I added a start_hour and end_hour feature to my simple time select. Here are the details from the README:
Simple time select also takes a start_hour and end_hour option to be specified in military format (between 0-23).
<%= time_select "event", "time", { :default => Time.now.change(:hour => 21), :simple_time_select => true,
:minute_interval => 20, :time_separator => "", [...]
The best time_select plugin for Ruby On Rails!
In some cases, the Ruby on Rails time_select helper is much uglier than it needs to be. It spits out 3 select boxes for the hour, minutes, and seconds. Your users do not always need accuracy to the minute. For example, you do not schedule doctor’s appointments for 3:13PM. You would at least [...]


Getting FancyUpload to work with Rails