Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 867319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:57:21+00:00 2026-05-15T09:57:21+00:00

I am a Rails noob and have a question. I have a feed aggregator

  • 0

I am a Rails noob and have a question. I have a feed aggregator that is organized by this general concept:

Feed Category (books, electronics, etc)
Feed Site Section (home page, books page, etc)
Feed (the feed itself)
Feed Entry

So:

class Category < ActiveRecord::Base
  has_many :feeds
  has_many :feed_entries, :through => :feeds, :limit => 5
  validates_presence_of :name
  attr_accessible :name, :id
end

class Section < ActiveRecord::Base
  has_many :feeds
  has_many :feed_entries, :through => :feeds, :limit => 5
  attr_accessible :name, :id
end

class Feed < ActiveRecord::Base
  belongs_to :categories
  belongs_to :sections
  has_many :feed_entries
  validates_presence_of :name, :feed_url
  attr_accessible :name, :feed_url, :category_id, :section_id
end

class FeedEntry < ActiveRecord::Base
  belongs_to :feed
  belongs_to :category
  belongs_to :section
  validates_presence_of :title, :url
end

Make sense? Now, in my index page, I want to basically say… If you are in the Category Books, on the Home Page Section, give me the feed entries grouped by Feed…

In my controller:

def index
    @section = Section.find_by_name("Home Page")
    @books = Category.find_by_name("Books")
end

In my view:

<%= render :partial => 'feed_list',
           :locals => {:feed_group => @books.feeds} 
-%>

This partial will spit out the markup for each feed entry in the @books collection of Feeds. Now what I need to do is somehow combine the @books with the @section…

I tried this:

<%= render :partial => 'feed_list',
           :locals => {:feed_group => @books.feeds(:section_id => @section.id)} 
-%>

But it isn’t limiting by the section ID. I’ve confirmed the section ID by using the same code in the console…

Make sense? Any advice?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:57:22+00:00Added an answer on May 15, 2026 at 9:57 am

    Try something like this:

    :locals => {:feed_group => @books.feeds.all(:conditions => {:section_id => @section.id})}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rails noob here. I have a rails application with (in this example) three tables.
This is a noob question: How do I add gems to my rails app
I am a noob in ruby on rails so excuse this question if it
Noob here. I have a rails app that has users and postings. I need
I'm a bit of a rails noob and have this situation. I have a
Sort of noob-rails question ;): I've got 2 actions in my controller - index
Noob question for Ruby on Rails- here's an example of my situation: If I
Rails has a nice idiom that makes it easy for you to have a
I appreciate this is an incredibly noob question, but having Googled multiple combinations of
I'm working in Rails 3.1 as a relative noob, and have managed to extract

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.