Network ActiveRecord relation with Rails

Posted by Zag zag.. on Stack Overflow See other posts from Stack Overflow or by Zag zag..
Published on 2010-05-23T08:51:01Z Indexed on 2010/05/23 9:00 UTC
Read the original article Hit count: 178

Hi,

I have a has and belongs to many relation between User and Article models, and I would like to link them even if an article if not hosted on the same database then a user.

For example, If an article exists at foo.com/articles/3 and a user exists at bar.com/users/1, If would like to be able to do from foo.com web interface or bar.com web interface this kind of query: a_user.articles (or an_article.users).

I think this can be possible adding a field like "url" in users and articles tables. But I don't know how to process for ActiveRecord. My Article model looks like this:

class Article < ActiveRecord::Base
  has_and_belongs_to_many :users
end

Is there yet some example of project using this kind of relation over internet?

Many thanks

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about activerecord