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 6907851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:29:13+00:00 2026-05-27T08:29:13+00:00

I have a nested model like this: ProgramGuide |-channels |-channel |-programs Now I want

  • 0

I have a nested model like this:

ProgramGuide
    |-channels
        |-channel
            |-programs

Now I want to get the very last ending program regardless of channels.

In the ProgramGuide model I have a method:

lastProgram : function(){
   //how to find last ending program?    
}

So, is there a good way to find the last ending program, maybe a way to flatten down the model tree for programs, or must I write a nested loop to achieve this?

  • 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-27T08:29:13+00:00Added an answer on May 27, 2026 at 8:29 am

    do know that backbone depends on underscore, so you always have underscore methods available
    i don’t have any exact code example, but i’m sure you don’t need to nest loops to run through your structure,

    i bet you can use any of these underscore methods,

    • underscore flatten possibly to flatten your structure (can get hard, because you get the normal model attributes with it, should need a workaround to only have the .toJSON() of each model
    • underscore filter could be used to filter out the attributes itself only, or to filter the program list
    • underscore sortBy could be used to sort on your air time, to get the last ending program
    • underscore pluck could be used to pluck only the ID, name and ending time, to remove all the clutter in your structure

    i will try to come up with an example, later today
    but i can’t promise when i have time for it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nested model structure that looks like this: resources :users, :path =>
I have an object model like this: public class MyClass { int TheProp {get;set;}
I have a view model that looks like this: public class VenueIndexViewModel : BaseViewModel
Hay I have a model like this def Photo(models.Model): # Photo object fields... def
I have a Client and ProposalRequest model that look like this: class Client <
I have a model like this: class Search include Mongoid::Document embeds_many :terms accepts_nested_attributes_for :terms
My models are like this: a discussion has_many posts (nested resource). I want to
I have a model with a has_one and polymorphic association like this: class Disc
I have a nested list, something like this: List<Hotel> Hotels; public class Hotel {
I have an object model that looks like this: public MyObjectInJson { public long

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.