I can read my database using Mongoid, but cannot write to it.
This example below successfully outputs the activity's device type, but it crashes on the save method with this error message: "undefined method `name' for nil:NilClass"
activity = Activity.find('4d89568d4f21557eb10003fc') puts activity.deviceType activity.description = 'my description' activity.save
Here are my class definitions:
class User include Mongoid::Document field :name, :type => String field :identifier, :type => String field :email, :type => String referenced_in :activity end class Trackpoint include Mongoid::Document field :when, :type => DateTime field :latitude, :type => Float field :longitude, :type => Float field :distance, :type => Float field :altitude, :type => Float field :heartRate, :type => Integer embedded_in :activity, :inverse_of => :trackpoint end class Activity include Mongoid::Document field :startTime, :type => DateTime field :description, :type => String field :sport, :type => String field :deviceType, :type => String field :deviceId, :type => String field :deviceActivityId, :type => String field :isPublic, :type => Boolean field :user_id, :type => String embeds_many :trackpoints references_one :user end
Thanks for any help...