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]
Rails Internationalization (I18n) API is a great way to start with multilanguage pages.
However, i found it quite horrible to specify my translations inside if the corresponding #lang.yml/.rb files etc.
After searching a bit, i found globalize2 – a nice plugin that creates localization-models for each model you want to translate.
quite all you have to add to your code is
1 2 3
| class Post < ActiveRecord::Base
translates :title, :text #this over here
end |
Quite nice, but: a new sql-request for each model you want to translate – that sucks!
[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
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]