how to bind association in RoR

Posted by ashok on Stack Overflow See other posts from Stack Overflow or by ashok
Published on 2010-06-11T12:10:56Z Indexed on 2010/06/11 13:12 UTC
Read the original article Hit count: 202

Filed under:

I have two tables, AppTemplate and AppTemplateMeta

AppTemplate table has column id, MetaID, name etc.

I have associated these two model like this

class AppTemplate < ActiveRecord::Base
  set_table_name 'AppTemplate'
  belongs_to :app_template_meta, :class_name => "AppTemplateMeta", :foreign_key => 'MetaID'
end

If we fetch data using AppTemplate.all, I want associated meta details also. But currently it's not returning associated meta details. It just returns AppTemplate details. any guys can help me for this

© Stack Overflow or respective owner

Related posts about ruby-on-rails