I'm using Rails 2.3.5.
All of my tables include the default timestamps (created_at and
updated_at) including my join tables for has_and_belongs_to_many
(habtm) associations. When I retrieve the habtm objects using the
convention task.colors, Rails returns the timestamps
from the join table instead of the color table. Since it returns
Color objects, the timestamps should be from the colors table since
that reflects when the Color object was last updated.
Both tables have timestamps, is Rails confusing the two? Or is
this by design?
class Task < ActiveRecord::Base
has_and_belongs_to_many :colors
end
class CreateColorsTasks < ActiveRecord::Migration
def self.up
create_table :colors_tasks, :id => false do |t|
t.integer 'color_id', :null => false
t.integer 'task_id', :null => false
t.timestamps
class CreateTasks < ActiveRecord::Migration
def self.up
create_table :tasks do |t|
t.string 'name'
t.timestamps
class CreateColors < ActiveRecord::Migration
def self.up
create_table :colors do |t|
t.string 'name'
t.timestamps