link_to_unless_current without request parameters

June 12, 2008

Not a really big thing, but I felt the need for a method like link_to_unless_current which ignores request parameters (you know, those things that come after the ‘?’ in the url). I couldn’t find it in the Rails api, so I wrote my own little snippet in a helper:


  # makes a link unless 'link' equals the current
  # page ignoring request parameters
  #
  # e.g. this will not make a link:
  #   current page = http://your.web.site/articles?page=2
  #   link = http://your.web.site/articles
  # but this will:
  #   current page = http://your.web.site/articles/2
  #   link = http://your.web.site/articles
  def link_to_unless_current_ignore_parameters(title, link)
    link_to_unless(request.request_uri.gsub(/\?.*/, '') == url_for(link), title, link)
  end

If someone knows a better way, please let me know :) I thought about aliasing the original method and having an optional boolean parameter that defines whether to ignore the request parameters, but decided to go with this instead.


Stratego: Next Edition released for DS

June 5, 2008

Not normally something I’d do, but my friends’ company (Triangle Studios) have had their first major title published by Ubisoft: Stratego: Next Edition.

I’ve played the RC and liked it quite a bit, this is definitely a title I would recommend to anyone who likes strategic games.

Congratulations to Triangle Studios :)

Cover Art