DelayedJob has always been a great “hit the ground running” background task runner for ruby. It is simple to setup, easy to use and can more than carry its own weight in tasks. Don’t know what a backround runner does or why you would use one? I will not delve into why you need one but you can check out a summary here: Background Jobs in Ruby on Rails.
I have used the asset pipeline heavily since its release in Rails 3.1.0 over two years ago. Only recently did I run in to a handful of gotchas when it came to dealing with stylesheet compilations using Sass. I guest wrote a post about my experience using SASS in the asset pipeline at Unbounce. Head on over to the Inside Unbounce blog to check out the full post.
I’ve spent almost the last two weeks dealing with Date and Time Zone related issues within one of the applications I contract on. This is a just a list of notable behaviours I expereinced whilst working with Ruby, Rails, Dates & TimeZones. Note: DST is in effect at the time of writing. Inconsistent Handling of DST In the code below we instantiate an ActiveSupport::TimeZone object. I would love to think that this instance would know everything about that Time Zone.
Last week during my main work contract I had been tasked with doing some would-be trivial content updates to a section of a client application. Content updates would normally involve hopping into a view changing some images or text and re-deploying. This particular section though is a little more complex then that and way more complex then it should be. The Setup This particular section of the application has rotating content.
A quick note on logging SQL queries in DataMapper 1.2 so you can see exactly what’s going on behind the scenes. Seeing the query can be beneficial in debugging when getting unexpected results or trying to increase query performance. DataMapper::Logger.new($stdout, :debug) Enter that at anytime while running in rails c and you should start seeing the output immediatley. Note If you don’t see the output potentially it’s because of DM’s identiity map.
Notes: Working with ruby 1.8.7 but 1.9 solution presented at bottom. While working on my main contract today I needed to create a new array based off mutated values of an existing array. Simple enough I’ll just use Enumerable::map right? Almost immediatley I realized I needed to make a reference to an array via the loops index. I first checked to see if a map_with_index existed similar to Enumerable::each_with_index. It doesn’t.
So while in the #RubyOnRails IRC channel late at night (never a good idea) some silly conversation occured: (someone gists some code) sevenseacat: empty array seems the silly thing to have Tarential: sometimes I like to add empty arrays, you know, just in case I need them later Tarential: so they’re close at hand tagrudev: little kittens die when you define an unused var brianpWins: but if you do want to leave empty arrays around.
- OLDER POSTS
- page 1 of 3