Tag Archives: rails

How to delete a many-to-many association with Rails

Judging by the number of Ruby on Rails developpers asking themselves this question, this is the missing example of Rails. (It’s not in my Rails reference book, and I’ve never seen any example on any blog.) One solution is to … Continue reading

Posted in Ruby on Rails | Tagged , , , | 6 Comments

Get rid of favicon.ico 404 errors with rails

Every time your browser loads an new url, it also request a file called ‘favicon.ico’ in the same subdirectory. This generates a LOT of errors in the Ruby on Rails logs of my app. One way to avoid those errors … Continue reading

Posted in Ruby on Rails | Tagged , , , | 1 Comment

has_and_belongs_to_many or has_many :through?

As you may (or may not) know, there are two ways to build a many-to-many (or N-N) relationship with Rails. The first way uses has_and_belongs_to_many in both models. You’ll have to create a join table that has no corresponding model … Continue reading

Posted in Ruby on Rails | Tagged , , | 4 Comments

Creating Rails Plugins

Just a link to “The Complete Guide to Rails Plugins” which is a reference.

Posted in Ruby on Rails | Tagged , | Leave a comment

Visualize your models

The “Visualize Models” plugin By Nils Franzen will generate .png images from the Rails model files : (click to enlarge) : This plugin depends on GraphViz, which you can find here. From your rails application root, run : ruby script/plugin … Continue reading

Posted in Ruby on Rails | Tagged , | Leave a comment

Autocompletion with Rails and Scriptaculous

Scriptaculous offers a nice autocompletion component that integrates quite well with Ruby on Rails.Here is a link that shows different ways to plug it in your rails application: http://www.slash7.com/articles/2005/08/13/ajaxariffic-au…

Posted in Javascript, Ruby on Rails | Tagged , , , | Leave a comment

Model validation with Rails

Rails has very nice features to validate a model (directly mapped on your database). However it gets sometimes sloppy if you don’t know the exact command to do your validation.Here’s a trick I had a hard time to find. Everybody … Continue reading

Posted in Ruby on Rails | Tagged , , | 2 Comments

Ruby on Rails with Apache2 and FastCGI

apt-get install ruby wget http://rubyforge.org/frs/download.php/3463/rubygems-0.8.8.tgz tar vxzf rubygems-0.8.8.tgz cd rubygems-0.8.8 ruby setup.rb gem update gem install rails

Posted in Ruby on Rails | Tagged , , | Leave a comment