Ash Joseph

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Share scopes/nested routes/inherited resources?

I'm in the process of learning Rails (loving it so far) and my play project (A task list, obvs) is structured a little like this:

Task -> belong to project/project has many tasks
Task has scopes for status, along the lines of:

scope :newest, -> { order(created_at: :desc) }
scope :oldest, -> { order(created_at: :asc) }
scope :priority_low, -> { order(priority_level: :asc) }
scope :archived, -> { where(archived: true) }

But I'd also like all of this shared on the project level for when I start implementing search and filtering.
This kind of thing:
So I'd like to do projects/id/task/id?complete=true

I've had a look through the guides (They are so comprehensive) but couldn't find anything that jumped out. Is there something in place so I can have projects inherit this all or do I need to duplicate the work?

Thanks in advance :)