This blog has been silent, due to working very hard on HotelTonight. Â HotelTonight is a new mobile (iPhone to start) app that makes it super easy to book same-day or last minute hotel stays. Â If you've headed into the city for a wedding, or a night on the town, for example, and decide you don't want to drive home; or maybe you're working late and just need to crash for the night, HotelTonight gives you a great rate (much better than if you just walked up to the hotel to see if they had a room). Â Furthermore, we allow you to book a room until 2am! Â Try that with any other service. Â We show you the specific hotels we have (and we have awsome ones like the Ace in New York, or the Nikko in San Francisco). Â The app has great photos of the hotels, and information that's important for such last minute bookings. Â It's a game changer for hotel bookings.
Comments [0]
Comments [0]
Comments [0]
UPDATE: As it turns out, the below solution was totally rookie! Â The whole issue is still there, but the need to solve it with the use of update_all (which is a bit brute force and generally something to avoid for just updating a couple attributes on a single record, it avoids validations, etc, etc.), was not necessary. Â As it turns out, there are association callbacks. I'm kind of surprised I hadn't seen this or thought of it. Â But, there are callbacks to be notified when associated records are added, or removed (and both the before and after variations). So, instead, instead of setting the update_lowest_and_highest_rates as an after_update, specify an after_remove callback on the association:
Then implement the update method like:
  def update_lowest_and_highest_rates
   fares.reload
   set_lowest_and_highest_rates
   save
  end
I recently ran into some tricky issues related to deleting records on an association combined with ActiveRecord callbacks. Â The issue may seem like an edge case, but from googling for solutions, clearly it's not an uncommon need. Â An example will illustrate the problem...
Comments [0]
James Hoffman's similar post inspired me to track my more simple espresso/coffee consumption for the month of February. Â As the following graphic shows, I drink primarily straight shots of espresso, averaging 2.5 shots per day, followed by moka pot, then macchiatos (which are typically what I'll have at a good cafe), etc. Â I have 3.13 espresso drinks total per day on average.
Comments [0]
I wanted to setup more significant caching for some heavy use types of pages on DealBase. Various things have made this challenging to date, but the last thing I ran into was dealing with the fact that query parameters change page results (duh), but that of course Rails' page and action caching ignore query parameters. There isn't an easy (or?) way to get around the page caching part unless you start mucking with Nginx rules as well I think. But, action caching has a solution. I had done a ton of Googling on this, and I knew about adjusting the cache_path, as well as some other bits, but we have cases where there are a lot of parameters. Plus, I didn't want to worry about what happens if I add a new search/filter type of parameter later on, and having to remember to add that to the list of things the cache_path differed on.
caches_action :my_action, :cache_path => Proc.new { |controller| controller.params }caches_action :action_one, :action_two, :cache_path => Proc.new { |c| c.params.delete_if { |k,v| k.starts_with?('utm_') } }, :expires_in => 4.hours, :unless => Proc.new { |c| c.request.xml_http_request? || c.send(:current_user).try(:admin?) }Comments [15]
I have spent roughly the last month using the RubyMine IDE for about 80%+ of my daily development work. I initially grabbed it to try out the debugger on a particularly nasty problem, and then decided to give it a real evaluation. My daily work is on DealBase, and covers the full spectrum of Rails development. The testing was done mostly using a quad-core Mac Pro with 8GB of RAM and 30" and 24" monitors (dual monitor setup), with RubyMine running essentially full screen on the 30". I also did some work on my MacBook Pro (Core 2 Duo, 4GB RAM). Both machines use Snow Leopard. My current and longtime editor has been TextMate, although I have far more time spent historically in environments like Visual C++/Studio, IDEA, a bit of time in Eclipse, a bit in Emacs, BBEdit, CodeWarrior, regularly use Vim, etc. To date, the speed and light weight of TextMate, combined with it's slick column editing feature (that's one killer feature), have kept me from switching. But, there may be some movement here...
Comments [14]
The iPhone app Boxcar has liberated my iPhone from the stress and worry caused by Twitter SMS. Â What?Â
Comments [0]
The jQuery autocomplete plugin is quite nice, and we use it a fair bit on DealBase. However, what I found was that if you set the mustMatch option, your text cannot contain commas, colons, and a few other punctuation (and maybe other) characters. For some reason that I've yet to track down (debugging through many nested anonymous functions and callbacks has yet to yield an answer), it thinks it changes at some point to not think it's a match. A good example of this is if you allow a user to type in a city name, but you want to show them matching cities with the state and/or country included, to disambiguation. E.g. you may have Portland, Oregon and Portland, Maine (not to mention the few Portlands in Australia :)
matchSubset option to true. This allowed it through, retaining the full text of something like "Portland, Oregon". According to the plugin's docs, matchSubset should only come into play when using the cache, which we don't use (because we limit results to 20 items, and often there are more than 20 matches, e.g. a user types "new" or "las" or something - many cities will match). Comments [6]
You are viewing a mobilized version of this site...
View original page here
Comments [0]