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.
D855690573f11a2eba3951203c603b7e?d=identicon&s=25 Sergio Bayona (Guest)
on 2006-04-08 08: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,
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2006-04-10 15:04
(Received via mailing list)
Sergio Bayona 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.
5f3d7eb9e9314f4eb94b4040cee4d8d2?d=identicon&s=25 Vince Puzzella (Guest)
on 2006-04-10 22: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?

5f3d7eb9e9314f4eb94b4040cee4d8d2?d=identicon&s=25 Vince Puzzella (Guest)
on 2006-04-10 22:45
(Received via mailing list)
BTW, I am using mysql 5.0.16 and ruby 1.8.2
525128e48ca2b4c7fb6176ea166fccfd?d=identicon&s=25 Eric G. (gotskill10)
on 2006-10-10 07: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.