www.question-defense.com | Engage: Visit :: Login :: Register
Translate to English Übersetzen Sie zum Deutsch/German Переведите к русскому/Russian Μεταφράστε στα ελληνικά/Greek Vertaal aan het Nederlands/Dutch ترجمة الى العربية/Arabic 中文翻译/Chinese Traditional 中文翻译/Chinese Simplified 한국어에게 번역하십시오/Korean 日本語に翻訳しなさい /Japanese Traduza ao Português/Portuguese Traduca ad Italiano/Italian Traduisez au Français/French Traduzca al Español/Spanish

Posts Tagged “restful resources”

0

In case you’re not a Rails programmer, ActiveRecord has this great ‘convention over configuration’ feature that defines a many to many relationship called the has_many_and_belongs_to association. For example, if you’re mapping many users to many devices, then the join table must named with both tables names (in this cas devices_users).  What I didn’t realize until Matt Smith pointed it out is that the order of the names must be alphabetical. The join table cannot be named users_devices. Common sense but thought I would point it out.

This coincides with another (but less obvious) alphabetical caveat I ran into with Rails a while ago: XML nodes in the XML for RESTful posts (for RESTful resources) must be in alphabetical order.

And don’t forget, a column name can’t be named ‘type’ because Rails uses that keyword internally. For single table inheritance, for instance.

DeliciousStumbleUponDiggTwitterMixxTechnoratiFacebookNews VineLinkedInYahoo! Bookmarks
Tags: , , , , ,

Comments No Comments »