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

47 lines
803 B
Ruby
Raw Normal View History

2012-09-23 02:39:12 +00:00
class UsersController < ApplicationController
respond_to :html, :json
2012-09-23 02:39:12 +00:00
2014-07-27 19:57:35 +00:00
# GET /users/1.json
def show
@user = User.find(params[:id])
render json: @user
2014-08-12 22:14:04 +00:00
end
2014-07-27 19:57:35 +00:00
2014-08-12 22:14:04 +00:00
# GET /users/:id/edit
2012-09-23 02:39:12 +00:00
def edit
@user = current_user
respond_with(@user)
end
2014-08-12 22:14:04 +00:00
# PUT /users/:id
2012-09-23 02:39:12 +00:00
def update
@user = current_user
@user.attributes = params[:user]
@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