Nellboy wrote:
> Personally, I'd probably take the approach of adding a 'feed_item'
> table to the database and tie it to the user with a 'has_many'
> relationship
>
> then when user x updates their favourites, you can put something like
> "#{user.name} has added #{recipe.name} to their favourites" into the
> feed_item table with a user_id passed in as a parameter, and you can
> make these feed items appear on the homepage of whoever is following
> or is friends with this user...
>
> no plugins required (i don't think anyway)
>
> On Dec 24, 8:41�pm, "Ashley Williams" <[email protected]>
I don't think your method is very different from the one Ashley and I
were talking about. I created an "actions" table and tied it to the user
table. The thing is, I also tied it to my recipes, favorites, and
comments table. That way, whenever anyone adds a recipe, makes a recipe
a favorite, or adds a comment, an entry is added to the "actions" table.
That entry includes the id of the user so I know who did it.
When I list my feed, the view code is (truncated example):
<% @friendfeed.each do |friendfeed| %>
<%= link_to friendfeed.user.login, :controller => "users", :action =>
"show", :id => friendfeed.user.id %> favorited <%= link_to
friendfeed.recipe.title, :controller => "recipes", :action => "show",
:id => friendfeed.recipe.id %>
<% 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
-~----------~----~----~----~------~----~------~--~---