Quantcast
Channel: Filtering microposts feed by User profile - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Alex D for Filtering microposts feed by User profile

I'm not sure why Microposts have bothbelongs_to_id and user_id. But if you want to find all the Microposts whose belongs_to_id matches a given User's ID, all you need is:@microposts =...

View Article



Answer by miked for Filtering microposts feed by User profile

Here's an approach with a named scope in the MicroPost class only if you want the posts where the user_id AND belongs_to are the same:micropost.rbclass MicroPost < ActiveRecord::Base scope...

View Article

Filtering microposts feed by User profile

On our site we have a user profile page where we want to display all microposts that are relevant to that User's profile.In our microposts table we have a belongs_to_id column and a user_id (defines...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images