Forum: Ruby on Rails saving related objects using has_many_through associations

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sergio B. (Guest)
on 2006-04-08 10:28
(Received via mailing list)
This only saves the @person but not the @address. Shouldn't it save

     @person =[:person])
     @address =[:address])
     @person.address << @address

here is what I have:

class Person < ActiveRecord::Base
   has_many :addressables
   has_many :addresses, :through => :addressables

class Address < ActiveRecord::Base
   has_many :addressables
   has_many :people, :through => :addressables

class Addressable < ActiveRecord::Base
   belongs_to :address
   belongs_to :person

Any help would be appreciated,
Mark Reginald J. (Guest)
on 2006-04-10 17:04
(Received via mailing list)
Sergio B. wrote:
>   has_many :addressables
>   belongs_to :person
> end

No, at present you have to explicitly create the Addressable object.

You may be better of using a has_and_belongs_to_many association,
since your Person<->Address association has no accessory attributes.

We develop, watch us RoR, in numbers too big to ignore.
Vince P. (Guest)
on 2006-04-11 00:30
(Received via mailing list)
Hi Folks,

I just upgraded rails from 1.0.0 to 1.1.2.  Suddenly, some of my "if
conditions" stopped working as expected.  It seems as though
Rails/ActiveRecord now treats tinyint(1) columns as boolean instead of
integers (like v1.0.0).

I was just wondering if anybody else has experienced similar behavior?
so, is there a quick work-around that doesn't involve me doing a search
replace and retesting my entire app?

Vince P. (Guest)
on 2006-04-11 00:45
(Received via mailing list)
BTW, I am using mysql 5.0.16 and ruby 1.8.2
Eric G. (Guest)
on 2006-10-10 09:07
yeah ive been experiencing the same thing, anybody know how to get
around this or what the deal is?
This topic is locked and can not be replied to.