I think I''ve figured it out. Sorry for posting what amounts to an
architectural question here, I''m guessing that''s not really
what this
board is for.
For anyone curious about what I decided to do:
I haven''t totally decided yet. I might trash the idea of a
"Verification" class, and instead opt for a Vote class:
Vote:
type
user
Then it would be a polymorphic association like this:
class Vote < ActiveRecord::Base
belongs_to :voteable, :polymorphic => true
end
class Post < ActiveRecord::Base
has_many :votes, :as => :voteable
end
class Product < ActiveRecord::Base
has_many :votes, :as => :voteable
end
------------------------
Otherwise if I stick with my verification class, I think I''ll need to
do some sort of HMABT relationship, and I honestly don''t see the
point. So yeah. I''ll probably just do the Vote thing.
Cheers!
On Jan 27, 12:55 am, Steve H
<p.wi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> OK here''s the deal. I have a Verification object that I want to
use
> to allow users to verify data (Posts, Pics, Addresses, etc). Each
> Post, Address, etc object will be related 1:1 to a Verification
> object.
>
> But I want to have the Verification keep 3 separate lists of users. I
> have generated the following migration code, but i don''t think
it''s
> going to work properly:
> def self.up
> create_table :verifications do |t|
> t.references :voted_real
> t.references :voted_fake
> t.references :flagged
>
> t.timestamps
> end
>
> See I want voted_real to be a list of users who have voted
"Real",
> similarly :voted_fake should be a list of users who have voted
"Fake"
> and flagged to be a list of users who have "flagged" content (as
> offensive, inappropriate, etc).
>
> So you see, the standard options for ActiveRecord Associations will
> not suffice (as far as I can tell).
>
> Can someone help me out here? I maybe just need a different design or
> maybe I can use polymorphic associations, but I''m not sure yet. I
> think I can use polymorphic associations to associate the
> Verifications to the other objects, but not to accomplish what I want
> to do with the Verification to User relationship(s).
>
> I appreciate your help!!
>
> -Steve
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---