Suppose there is an application that is a collection of tasks for various programming languages and development sectors as a whole (for example, layout tasks).
You need to get a routing like this: / ruby / tasks / strings / replace_a_with_b / js / tasks / dom / get_element_by_tag_name ... and many others.
I do not need that to be so: / sector / php / tasks / ... That is, I don’t want something like sector, branch to be written in front of the language. It is necessary that you can immediately specify the language.
First I got the idea to use this:
get ':branch/tasks/', to: 'tasks#index' But the idea didn’t come up because I wanted to use the has_many - belongs_to association (many tasks can belong to the same development sector, one branch), and in this case you have to store the branch to which the task belongs in the same table with the task itself, which is not eat well
Then I thought to use scope or namespace, but I do not think that this is the most rational solution. Especially since then I, too, will have to store everything in one table.
Later decided to use resources:
resources :branch do resources :tasks end But then there will be complete confusion (1), I don’t think that this is a rational solution (2), the paths will not be the same as I need (3) (/ branches / 3 / tasks / 25) and instead of task names in the address I’ll have to use their id (exactly like the id of the development branch instead of its name).
How is this logic most properly organized?