Don’t end the name of fields in Ruby with ‘_id’
I was naming a field for a Ruby/Rails project. Since the field referred to an id for something, I named it according.. For example, product_id. That seemed to make sense.
However, I use a sorting routine to make the column names sortable on a click.
When I ran it through the sortable routine to make the columns sortable, I got a crash.
Apparently naming a field with an field name ending in _id gets things confused with associated fields.
I’m not sure if it affects anything outside of the sortable routine but my guess is that it could so I’d rather play it safe.
The problem arises because associated tables/fields in Rails depend on a key field with a field name ending in _id.
- Removing obsolete database tables from your Joomla site.
- Viewing your SQLLite Data (Ruby on Rails beginners)
- j17_finder_tokens error in Joomla Database
- Ruby on Rails – Setting the accepted parameters to allow hashes.
- Chrome ending support for Java, Silverlight and Flash???
- A summary of coding styles for Rails
- Accessing an external sql database from a rails app where the schema prefix differs from the schema prefix used for the app’s tables.
- Width of Fabrik Fields in Joomla with an Artisteer Template in IE and FIrefox