2012-09-23 02:39:12 +00:00
|
|
|
class UsersController < ApplicationController
|
|
|
|
|
2012-10-26 10:04:52 +00:00
|
|
|
before_filter :require_user, only: [:edit, :update]
|
2012-09-23 02:39:12 +00:00
|
|
|
|
2014-01-29 04:53:13 +00:00
|
|
|
respond_to :html, :json
|
2012-09-23 02:39:12 +00:00
|
|
|
|
|
|
|
# GET /user/edit
|
|
|
|
def edit
|
|
|
|
@user = current_user
|
|
|
|
|
|
|
|
respond_with(@user)
|
|
|
|
end
|
|
|
|
|
|
|
|
# PUT /user
|
|
|
|
def update
|
|
|
|
@user = current_user
|
|
|
|
@user.attributes = params[:user]
|
|
|
|
|
2014-05-14 20:51:16 +00:00
|
|
|
#@m = params[:metacodes][:value]
|
|
|
|
#@user.settings.metacodes=@m.split(',')
|
2013-01-26 01:49:40 +00:00
|
|
|
|
2012-09-23 02:39:12 +00:00
|
|
|
@user.save
|
2014-05-15 22:28:30 +00:00
|
|
|
|
|
|
|
sign_in(@user, :bypass => true)
|
|
|
|
|
2014-01-29 04:53:13 +00:00
|
|
|
respond_with(@user, location: session[:previous_url]) do |format|
|
2012-09-23 02:39:12 +00:00
|
|
|
end
|
|
|
|
end
|
2014-06-04 19:24:16 +00:00
|
|
|
|
|
|
|
# PUT /user/updatemetacodes
|
|
|
|
def updatemetacodes
|
|
|
|
@user = current_user
|
|
|
|
|
|
|
|
@m = params[:metacodes][:value]
|
|
|
|
@user.settings.metacodes=@m.split(',')
|
|
|
|
|
|
|
|
@user.save
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.json { render json: @user }
|
|
|
|
end
|
|
|
|
end
|
2012-09-23 02:39:12 +00:00
|
|
|
|
|
|
|
end
|