Rails and Stuff at Abel killed Cain

Ruby on Rails and other Webdevelopment

Posts Tagged ‘ fix ’

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 wanted to have a rather simple pagination without next and previous buttons (yah, the post title told you, eh?).

However, did not find any option to deal with it. But Will_Paginate provides a nice way to overwrite the link renderer in order to have full customization.

So i created the following:
[More]

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]

Routes in Rails are great. No doubt!

Anyways, it fails at URLs like “category/articleid-a-few-words-headline-stub.html” etc. if you try the following:

1
map.article '/:article-:stub.html', :controller=>'article', :action=>'show'

therefore here a quick workaround to get nice dashes in routes with article-id and so on.. [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!

Ever wondered how to e.g. send both, low and high-priority emails from the same server/app using ar_mailer in Ruby on Rails?

Propably not, since all your emails are low! But just try to imagine websites you could never get that public by yourself, having high priority mails. E.G. Passwordrecoverymail might be HP than a “new guestbook entry” and so on.

ar_mailer does not provide a solution for that problem yet, so here is my little patch.

[More]

The Rails-doc currently shows the wrong way how to deliver multipart/alternative emails w/ attachments.

In order to send some multiparts with attachments and have them readable, just cascade the parts like this: [More]