I have got a ajax call which deletes some data from database. The data is deleted properly, but The action returns a failure ...
code looks like this:
def remove_user_from_group
@usergroup = UserGroup.find params[:usergroup_id]
@user = User.find params[:user_id]
@usergroup.users.delete(@user)
if @usergroup.save
flash[:notice] = t("flash.deleted")
render :add_user_to_group
else
flash[:notice] = t("flash.login_failed_nouser")
render :add_user_to_group
end
end
Whats going wrong? I do exactly the same for adding data and it works fine.