mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 19:47:03 +00:00
Small cleanup on userStats assignment
This commit is contained in:
parent
e2429632a1
commit
2e10d26325
2 changed files with 3 additions and 8 deletions
|
|
@ -34,13 +34,8 @@ class HabitsController < ApplicationController
|
|||
|
||||
def update
|
||||
@habit = current_user.habits.find(params[:id])
|
||||
test = params[:habit]
|
||||
user_stats = params[:habit][:user_stats]
|
||||
params[:habit].delete('user_stats')
|
||||
@habit.user.lvl = user_stats['lvl']
|
||||
@habit.user.exp = user_stats['exp']
|
||||
@habit.user.money = user_stats['money']
|
||||
@habit.user.save
|
||||
user_stats = params[:habit].delete('user_stats')
|
||||
@habit.user.update_attributes({:lvl => user_stats['lvl'], :exp => user_stats['exp'], :money => user_stats['money']})
|
||||
|
||||
respond_to do |format|
|
||||
if @habit.update_attributes(params[:habit])
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class User < ActiveRecord::Base
|
|||
:recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
# Setup accessible (or protected) attributes for your model
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :lvl, :exp, :money
|
||||
|
||||
has_many :habits, :dependent => :destroy
|
||||
has_many :rewards, :dependent => :destroy
|
||||
|
|
|
|||
Loading…
Reference in a new issue