metamaps--metamaps/app/controllers/users_controller.rb

45 lines
829 B
Ruby
Raw Normal View History

2012-09-23 02:39:12 +00:00
class UsersController < ApplicationController
before_filter :require_user, only: [:edit, :update]
2012-09-23 02:39:12 +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]
#@m = params[:metacodes][:value]
#@user.settings.metacodes=@m.split(',')
2012-09-23 02:39:12 +00:00
@user.save
sign_in(@user, :bypass => true)
respond_with(@user, location: session[:previous_url]) do |format|
2012-09-23 02:39:12 +00:00
end
end
# 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