added validation feedback for memebr form

This commit is contained in:
manson 2014-07-16 19:39:23 +08:00
parent 0dccaacbaf
commit ccaede2f1d
1 changed files with 9 additions and 8 deletions

View File

@ -136,14 +136,15 @@ class Admin::MembersController < OrbitMemberController
def update def update
respond_to do |format| respond_to do |format|
if @member.update_attributes(member_profile_params) if @member.user.present?
if @member.user.present? @user = @member.user
@member.user.update(user_params) @user.update(user_params)
else else
@user = User.new(user_params) @user = User.new(user_params)
@user.save @user.member_profile = @member
@user.update_attributes(member_profile_id: @member.id) end
end
if @member.update_attributes(member_profile_params) and @user.save
if params[:edit_type]!="edit_privilege" and params[:member_profile][:role_status_ids].nil? if params[:edit_type]!="edit_privilege" and params[:member_profile][:role_status_ids].nil?
@member.update_attributes(role_status_ids: []) @member.update_attributes(role_status_ids: [])
end end