How to configure a has_many association with non-ActiveRecord model

Posted by Callmeed on Stack Overflow See other posts from Stack Overflow or by Callmeed
Published on 2010-03-26T19:44:41Z Indexed on 2010/03/27 5:13 UTC
Read the original article Hit count: 222

Filed under:
|
|
|

My Rails app has a normal ActiveRecord "Account" model stored in the database. The model will store the URL to a remote XML file which defines some other objects.

For example, the Account has_many :galleries but the Gallery model is simply defined by nodes in the XML document. So how do I get /accounts/1/galleries to show the galleries from that account's XML?

How do I setup this relationship? I know how to do basic non-AR models, but I'm not sure how to define the association or if I need to create a Gallery model at all.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about activerecord