I have tables:

users (id, name)
computers (id, name)
mobiltelefons (id, name)

OwnComputers (id, user_id, computer_id)
OwnMobiltelefons (id, user_id, mobiltelefon_id)

So is it  has_many :through or has_and_belongs_to_many or what?

I only need to search one "own" table at time:
All computers that user "xx" owns OR
All Mobiltelefons that user "xx" owns OR
who owns mobilitefon "zz" OR
who owns computer "yy"

So...

class Computers < ActiveRecord::Base
  has_many :OwnComputer
  has_many :user, :through => :OwnComputer
end

class OwnComputers < ActiveRecord::Base
  belongs_to :Computer
  belongs_to :User
end

class Users < ActiveRecord::Base
  ???
end

class Mobiltelefons < ActiveRecord::Base
  ???
end

class OwnMobiltelefons < ActiveRecord::Base
  ???
end
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to