Rails and MongoDB with MongoMapper

Posted by FCastellanos on Stack Overflow See other posts from Stack Overflow or by FCastellanos
Published on 2010-05-14T03:16:54Z Indexed on 2010/05/14 3:24 UTC
Read the original article Hit count: 321

Filed under:
|

I'm new to Rails development and I'm starting with MongoDB also.

I have been following this Railscast tutorial about complex forms with Rails but I'm using MongoDB as my database. I'm having no problems inserting documents with it's childs and retrieving the data to the edit form, but when I try to update it I get this error

undefined method `assert_valid_keys' for false:FalseClass

this is my entity class

class Project 
  include MongoMapper::Document

  key :name, String, :required => true
  key :priority, Integer

  many :tasks
  after_update :save_tasks

  def task_attributes=(task_attributes)
    task_attributes.each do |attributes|
    if attributes[:id].blank?
      tasks.build(attributes)
    else
      task = tasks.detect { |t| t.id.to_s == attributes[:id].to_s }  
      task.attributes = attributes
    end
  end    
end

def save_tasks
  tasks.each do |t|
    t.save(false)
  end
end  
end

Does anyone knows whats happening here? Thanks

© Stack Overflow or respective owner

Related posts about mongodb

Related posts about ruby-on-rails