Closed shamil614 closed 12 years ago
I've got the same issue.
maybe the line https://github.com/raw1z/amistad/blob/master/lib/amistad/mongoid_friend_model.rb#L52 is the reason? I've tried to remove this define_method
part and seems to be working ok. But I think your concern about introducing write_attribute
was in the case of existing database, when all the users may not have the required fields yet (they will be added after first save
called on those objects). However, default values on all the required fields seems to be working fine.
I'm just starting to get to use Amistad with Mongoid and I'm finding that current_user.invite(@user) is not saving to the Mongo. I've done this in the console and in the Rails application, which I've determined that the method does work, as the method returns true, but the data does not persist. Has anyone else had this problem? My mongo db does work. I've saved all sorts of data with it, but the Amistad friend methods are not.
Here's some of the log output after the .invite() is run. I also did a current_user.save() just to make sure that I could see Mongo output a save
MONGODB yansn_development['system.namespaces'].find({}) MONGODB yansn_development['users'].find({:_id=>BSON::ObjectId('4f8b100dbf0d820513000007')}).limit(-1).sort([[:_id, :asc]]) MONGODB yansn_development['users'].find({:_id=>BSON::ObjectId('4f8b0fd2bf0d82055b000001')}).limit(-1).sort([[:_id, :asc]]) MONGODB yansn_development['users'].update({"_id"=>BSON::ObjectId('4f8b100dbf0d820513000007')}, {"$set"=>{"last_name"=>"hamilton123", "updated_at"=>2012-04-15 19:06:21 UTC}})
Shouldn't there be a save for the invite() method?