On Wed, Jan 25, 2012 at 1:15 PM, Peter Vandenabeele
wrote:
> On Wed, Jan 25, 2012 at 11:31 AM, Bala TS wrote:
>
>> Hai!
>>
>> One-to-one
>>
>> use has_one in the base, and belongs_to in the associated model.
>>
>> class Parent < ActiveRecord::Base
>> has_one :child
>> end
>>
>> class Child < Act
On Wed, Jan 25, 2012 at 11:31 AM, Bala TS wrote:
> Hai!
>
> One-to-one
>
> use has_one in the base, and belongs_to in the associated model.
>
> class Parent < ActiveRecord::Base
> has_one :child
> end
>
> class Child < ActiveRecord::Base
> belongs_to :parent# foreign key - parent_id
> end
>
Hai!
One-to-one
use has_one in the base, and belongs_to in the associated model.
class Parent < ActiveRecord::Base
has_one :child
end
class Child < ActiveRecord::Base
belongs_to :parent# foreign key - parent_id
end
Try this way:
Bye:)
Bdeveloper01
--
Posted via http://www.ruby-forum
3 matches
Mail list logo