Update profile

This commit is contained in:
magnolia-fan
2011-04-16 00:34:39 +04:00
parent b3e6a3d1c7
commit 00918b93af
2 changed files with 9 additions and 4 deletions
+6 -1
View File
@@ -53,7 +53,12 @@ class UserController < ApplicationController
def update
@data = User.collection.find({session_key: Digest::SHA256.hexdigest(request.session['session_id'])}).first
unless @data.nil?
if request.request_method == 'POST'
if params[:name]
@data.name = params[:name]
end
User.collection.update({_id: @data._id}, @data.attributes)
end
else
render :json => 'wtf?'
end