I am working on a rail app, through an active resource facility of rail, an authentication system for other rail applications Will work as.
The authentication app has an ActiveRecord model called a user
. The customer app has an active processing model called user
. I know that in the Client app I can do stuff like user.save
and it will perform a one-time operation using XML on HTTP.
But if I want to put in my customer's app user
model is: contact
or something like this ( contact
) Being an ActiveRecord model in the app)?
Is it possible
( I saw that one was asked, but there were not many responses.)
short answer: no. The classes included in has_many
, related_to
, has_and_belongs_to_many
live in ActiveRecord and the association creates SQL queries for working.
She said, you can make such a union, you just have to write your own way, that question was answered up-vote on what was connected to you.
Therefore, add a column to your contact model which is user_id
or whatever you want your User.find
ActiveResource model and you are thus Can be part of the contract:
class users & lt; ActiveResource :: Base # boilerplate ActiveResource url stuff def contact contact. Context (: All ,: conditions => gt; {user_id = & gt; self.id}) and end class contact & lt; ActiveRecord :: Modal DIF User User.find_by_user_id (self.user_id) End end
Very high you can get from has_many
for free, but its The essence is this
Comments
Post a Comment