project has one_to_many association with stages and financial
stage has one_to_many association with task
task has one_to_many association with sub_task.
In Financial#form view i am trying to pass id to collection_select as an array of combined ids like (eg:-id of stage, id of parent stage . id of task, id of stage.id of task. id of sub_task . id of sub_task)
Also drop-down first accesses all stages then task in current scenario is how can i turn drop-down like first stages then their corresponding all task followed by all sub_tasks?
How can code identify which value is from which table, because drop-down comes from multiple table based on reference
form.html.erb (Finacial)
<div class="field column large-8">
<br>
<%= form.label :acitivity_Select %>
<%= form.collection_select :cost_head, @project.stages.all+ @project.tasks.all+ @project.sub_tasks.all, :id, :task_name, prompt: true %>
</div>
project.rb
has_many :stages
has_many :tasks, through: :stages
has_many :sub_tasks, through: :tasks
