JqueryUI datepicker with rails and simple_form - the easy way

If you have a rails app, you've no doubt noticed that the default select date pickers are a little less than ideal. You may have just thrown in jQueryUI and replaced them with a text input type, and perhaps used a date format that rails understands because the more common (in the US) option of mm/dd/yyyy is parsed as dd/mm/yyyy.

Using capybara as a javascript capable replacement for Mechanize

Recently I had a task come to me, to update a content scraper that was written years ago with Ruby and Mechanize. Unfortunately in the interim, the site had been completely revamped and was useless without javascript. Even though mechanize has been updated over the years, it still does not support javascript. This left me in something of a quandry... So I though, well, I do testing of rails apps that is essentially like screen scraping, and I have used a driver that supports javascript...

Why I love rails

has_many :sales, :foreign_key => :CardID do
  def most_recent
    first(:order => "DateSold DESC")
  end
  def active
    first(:conditions => ["EffectiveDate <= :date AND ExpirationDate >= :date", {:date => Time.now}])
  end
end

There you go.

@object.sales = array of all sales
@object.sales.most_recent = most recent sale
@object.sales.active = sale with a date range that contains today

MongoDB in the real world

With MongoDB 1.8 out, I'm seeing some renewed debate about it's place in modern web development. In general I've experienced 3 reactions when it comes to mongo...

Drupal Performance and Scaling Part 1 - Anonymous Users

Recently I got curious about how well, overall, Drupal performs and how well it can be made to scale. I've been doing some experimenting with different setups and benchmarking and thought I'd offer, in one place a nice summary of the options available to scale drupal websites and my opinion of the various options. The first part of this covers the basic built in drupal performance features and is a good introduction for new users. After that we'll explore some more advanced scaling techniques.

Creating custom filters with drupal and views

Ah views. Yes, the views module for Drupal is incredibly powerful and combined with CCK has essentially eliminated the need to ever create custom modules for content. While this is a happy thing, sometimes views just doesn't quite do what you want. And, rather sadly, there is almost no documentation on how to create custom views plugins/styles/filters/etc. Boo.

Subscribe to chadcf RSS