Archive for the ‘Rails’ Category

seesaw gem configuration

Monday, November 10th, 2008

I cant find good examples and help in Internet for seesaw gem. Maybe it is used only by very experirienced rails persons. I will publish my configurations in case they are helpfull to some one. guda@guda-desktop:~/system3/config$ cat seesaw.yml --- restart_cmd: sudo kill -HUP `cat /usr/local/nginx/logs/nginx.pid` config_symlink: http_cluster/cluster.conf mongrel_config_path: /home/mongrel/system3/current/config/mongrel_cluster.yml config_path: /home/mongrel/system3/current/config config_files: all: cluster_all.conf ...

Installing notes for Rails on Debian/Ubunto

Thursday, November 6th, 2008

Debian Etch with backports Add this line in sources.list to get rails > 1.8.5 in rails etch deb http://www.backports.org/debian etch-backports main contrib non-free # deb ftp://ftp.nz.debian.org/backports etch-backports main contrib non-free apt-get install debian-backports-keyring aptitude update # some ruby stuff aptitude install -t etch-backports ruby1.8-dev libmysqlclient15off libmysqlclient15-dev mysql-common mysql-client libmysql-ruby1.8 # some system utils/libs aptitude install apt-utils build-essential mysql-server mysql-common ...

Chunks for the String method.

Wednesday, September 10th, 2008

If you want to generate some sort of chunks from a large strings you can use the following method. You give as a param an array of arrays, each array is pointing with % the start position of the chunk and the last position. class String def String.random_alphanumeric(size=16) ...

Rails caching notes

Tuesday, August 26th, 2008

General Notes Very nice tutorial for rails 2.1 caching. API references: Fragments, Sweepers, the Store Post how to move the page cache in a folder with some server examples Observing Controllers with Sweepers Here is described how you can use the Sweepers to observe controller actions. I totaly agree that the documenation is very bad ...

Nginx with Rails

Tuesday, August 19th, 2008

downloaded from here documentation here If you want to try different solution check it haproxy (more...)

Do you need to change a filename before sending it ?

Thursday, July 17th, 2008

Rails action to send binary data I have one old application where the attachment is store as an id in the filesystem. The customer wants to have the attachment with the right name. So I have made this small action which accepts the id of the requested object and send the ...

Random images helper for Rails

Tuesday, July 1st, 2008

Here is how to make random images generation for your website. First you must put your images in a folder /public/images/random_images or what ever. Second you put images there and mark the filenames with a prefix, which image to which section will be visible on. index_bottom_1.jpg -> for the index page on the ...

Only get, head, post, put, and delete requests are allowed.

Friday, June 13th, 2008

I got this error when I have to upgrade one old project from rails 1.2.5 to rails 2.1 ActionController::MethodNotAllowed Only get, head, post, put, and delete requests are allowed. The exception: ActionController::MethodNotAllowed (Only get, head, post, put, and delete requests are allowed.): /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/recognition_optimisation.rb:65:in `recognize_path' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:384:in `recognize' I got this ...

Rails plugins, gems, search engines

Monday, May 26th, 2008

Plugins & gems lists Associations http://www.workingwithrails.com/railsplugin/4801-has-many-polymorphs Versioning of AR http://github.com/fatjam/acts_as_revisable/tree/master http://opensoul.org/2006/7/21/acts_as_audited Scafolding http://streamlinedframework.org/pages/about Ajax pagination with JQuery http://ozmm.org/posts/ajax_will_paginate_jq_style.html Find_by_param is a nice and easy way to handle permalinks and dealing with searching for to_param values http://github.com/bumi/find_by_param/tree/master Asset Plugin - better than rails 2.0 integrated http://synthesis.sbecker.net/pages/asset_packager Image Magic http://vantulder.net/rails/magick/ OpenID http://wiki.rubyonrails.org/rails/pages/OpenidLoginGenerator http://github.com/technoweenie/restful-authentication/tree/master http://github.com/mrflip/ Model graph visualize Article on franzens.org http://visualizemodels.rubyforge.org/ http://rav.rubyforge.org/ http://railroad.rubyforge.org/ Simple Captcha http://expressica.com/simple_captcha/ Memcached stuff http://townx.org/rails_and_memcached Good rails 2.1 overview memcached -vv -l 127.0.0.1 -p 11211 -m 256 -P ...

will_paginate with ajax

Friday, May 16th, 2008

It is very easy to handle ajax pagination as described on this post here. I want to give one full example. Here is how my form looks: <% form_remote_tag :url => { ...