Forum: Ruby on Rails build from form has_many through

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3cf4fd3b2754a837689894db479c154c?d=identicon&s=25 Adel M. (adel_m)
on 2017-01-08 03:48
Attachment: redmine.jpg (100 KB)
hello.
i would like to add to an existing project some future.
i work with redmine, i would like to create for each project a
check-list.
check-lists are managed by admin, so he can create , update and delete
tasks.
A check-list look like:
Commercial:
 task-1
 task-2
 task-n
developper:
 task-..
 ....

its just an example, admin can create other tasks and tasks-categroie.
this part is ok:
i have a model named ncchecklist:

class Nccheklist < ActiveRecord::Base
  belongs_to :parent, class_name: "Nccheklist"
  has_many :children, class_name: "Nccheklist", foreign_key: :parent_id

  def self.roots
    return Nccheklist.where(parent_id: nil)
  end

  def siblings
    if parent
      parent.children.where.not(id: self.id)
    else
      Nccheklist.top_level.where.not(id: self.id)
    end
  end

  def has_parent?
    parent.present?
  end

  def is_leaf?
    self.children.empty?
  end

  def is_root?
    parent.nil?
  end
  def has_children?
    children.exists?
  end

end


now i would like to add a form in the project view with tasks and radio
button true/false, and user check it if he and the task.

each project have all tasks but of course with different value.
the goal is that each user ( employee ) say if yes or no he has end task
attached to his position.


hope some-one can help me and sorry for my poor english.
This topic is locked and can not be replied to.