app/controllers/faalis/api/v1/users_controller.rb in faalis-0.26.3 vs app/controllers/faalis/api/v1/users_controller.rb in faalis-1.0.0.alpha0

- old
+ new

@@ -2,12 +2,12 @@ module Faalis class API::V1::UsersController < ::APIController def index - @users = User.joins(:group).all - authorize! :read, @users + @users = User.joins(:groups).all + #authorize! :read, @users respond_with(@users) end def show @user = User.find(params[:id]) @@ -33,12 +33,12 @@ if params.include? :password and params[:password] user_fields[:password] = params[:password] end - if params.include? :group and params[:group] - user_fields[:group] = Group.find(params[:group]) || nil + if params.include? :groups and params[:groups] + user_fields[:groups] = Group.find(params[:groups]) || nil end if @user.update(user_fields) respond_with(@user) else @@ -56,12 +56,12 @@ last_name: params[:last_name], email: params[:email], password: params[:password], }) - if params.include? :group - group = Group.find(params[:group]) || nil - @user.group = group + if params.include? :groups + group = Group.find(params[:groups]) || nil + @user.groups = group end if @user.save respond_with(@user) else