Rails and Stuff at Abel killed Cain

Ruby on Rails and other Webdevelopment

Posts Tagged ‘ workaround ’

Building Websites is fun!

Having IE6 Users sucks instead!

Get rid of them by pasting the following code into your document-head.

<!–[if IE 6]>
<script type=”text/javascript”>
alert(”No IE 6! Thanks!”);
document.write(’<style>*{position:relative}</style><table><input></table>’)
</script>
<![endif]–>

IE 6 will crash after asking the user not to use it!

I had the following problem to solve using rails:

  1. Having 2 Subdomains, www and clients
  2. a client always has a path-prefix to use google analytics for each of this subdirs. so i had the following urls:
    www.domain.tld/foo.html  and clients.domain.tld/3kunsdf7w/foo.html
  3. I did not want to have a code on www.
  4. i did not want to alter all tempaltes with new paramters and differen routes

Solving this, it was ok for me to duplicate all routes with a client_  prefix using textmate, so i took onl 4 seconds.. but what next, how to tell rails to use the clients_xy_path when i call xy_path?

[More]

Guess you never had and never will have this issue!

Anyways, a note for me about rails complaining about a too long cache key like by caching a list fo products in an eshop.

so instead of e.g. the following pseudo fragment-cache code

1
2
- cache [ @products, "things_i_dont_own"] do
    = render :partial...

try, only if its a sequential list:

1
2
- cache [[ @products.first, @products.last], "things_i_dont_own"] do
    = render..

if its a random created list, maybe you want to map all ids, like

1
@products.map{|x| x.id}

if @products is a big list, try to create indiviual hashes instead and use sweepers.

regards!