Category Archives: Rails
I’ve previously covered how to use an external script from within a Rake task. This time, we want to be able to pass an optional argument to our task, that will be used within our external script, too.
Rails uses partials a lot, and you can even use partials as mini-layouts. What I wanted to do is render flashes either as a normal partial (i.e. passing a string of text to be displayed), or as a layout (passing … Continue reading
Using Rake to call an external script is quite straightforward: you can simply load it, or call “system”, or “exec”. By the same token, using ActiveRecord classes in a Rake task is easy: you just need to state your task … Continue reading
One step in getting to a snappy website experience is reducing HTTP requests. One technique contributing to this reduction is using CSS sprites for icon links. Today, however, I’ll show you how you can achieve the same objective using data-uris. … Continue reading
Several months ago, I took a look at Rails 3 in Action by Ryan Bigg and Yehuda Katz. The publisher has since provided me with a copy of the first edition, and I’m pleased to say that while the eBook … Continue reading
In a recent Rails 3.1 project, I wanted to have some values updated via AJAX when a checkbox value is checked or unchecked. As I was unable to find anything on the subject online, I figured I would document it … Continue reading
In one of my side projects, I needed some setup data to be present in the test database before each Cucumber session. Since this took me a few moments to get right, I figured I’d document it here.
I’ve lately started to use Cucumber and Selenium (via Capybara) “for real” to be used as the testing mechanism on my latest Rails project. In fact, I’ve been relying on it quite heavily to test views : I skipped the … Continue reading
I recently ran into an issue using the permanent records gem: when you permanently destroy a record (i.e. NOT soft delete), the dependent records with a `:dependent => :destroy` relationship are only soft deleted (i.e. marked as deleted, but kept … Continue reading