How to create nested forms using rails 3 and datamapper?

my models in datamapper:

Project:

require "dm-accepts_nested_attributes"

class Project

  include DataMapper::Resource

  property :id, Serial

  property :project_title, String

  has n, :tasks

  accepts_nested_attributes_for :tasks

end

Task:

class Task

  include DataMapper::Resource

  property :id, Serial

  property :task_name, String

  belongs_to :project

end

Now I wanted to create a view for the project with links to add tasks. I tried this with nested_form gem and cocoon , but not use it.

+3
source share

All Articles