Ashley Williams wrote:
> You'd have to have some polymorphic columns in an "actions" table,
> something like:
> 
> id                     #=> 1
> comment_id    #=> 15
> favourite_id     #=> nil
> user_id            #=> 10
> created_at      #=> Wed Dec 17 03:14:41 0000 2008
> 
> Then you can do something like:
> 
> Newsfeed.all(:conditions => { :user_id => 1 }, :include => [:comment,
> :favourite], :limit => 25)
> 
> �At least I THINK that'd work, but I think it would � something
> similar anyhow! :)
> 
> On Wed, Dec 24, 2008 at 5:16 PM, Dave Amos

Thanks, duh, that makes sense to me. I just created the database, and 
now I'm going to start writing methods that connect everything with the 
actions table so I can get some data in there.

I have a performance-related question. I don't think it'd be too 
demanding to ask the action table "show me everything this user has 
done" because it's just a :conditions => [:user_id = 1}. How crazy is it 
to ask the actions table "show me every time someone else favorites or 
comments on my recipe"? I believe this is possible with the actions 
table you have laid out, but will it take a while to grind out of the 
database?
-- 
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to