Note that there are some explanatory texts on larger screens.

plurals
  1. PORails Data Model Grouping Entities By Date
    primarykey
    data
    text
    <p>Developing a web application that will act similar to a daily journal. The user can maintain several different lists of data for a given date. For the sake of discussion say we have two models, Notes and Tasks. </p> <p>I would like to present a view to the user of dates they can navigate through showing the data for each date. Maybe in a strictly list view such as:</p> <pre><code>Jan 1 ====== Tasks: 1 - First task is here 2 - Second task is here Notes: 1 - First note is here Jan 4 ===== Tasks: No tasks Notes: 1 - A note is here. 2 - Another note... &lt;&lt; Older Entries Newer Entries &gt;&gt; </code></pre> <p>Or maybe presented as a calendar having dates which have corresponding data marked or highlighted somehow. </p> <p>I started down the path building out my models as just Notes and Tasks, each having a journal_date on them. This works fine when navigating each model index independently. Such as myapp.com/notes/ or myapp.com/tasks/ But I'm not sure how difficult it will be to consolidate each list into one view grouped by date. </p> <p>I also considered having a model called JournalEntry, which has a journal_date, and has_many notes and has_many tasks. Then the notes and tasks wouldn't have a date, but they would each belong to a journal_entry which has a date. I think that would simplify things a bit. But I've read a few blog posts which say stay away from nested resources if possible. So something like: myapp.com/nick/journal_entries/2012-dec-23/tasks/ they say to stay away from because of the code becoming complex. </p> <p>So I'm wondering how some more experienced rails developers would approach this problem? Which approach would you use, or would you handle it completely differently? </p> <p>Nick</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload