I have the following code:
def create
@user = User.new(params[:user])
simp_ = User.new(params[:user])
if @user.gender.blank?
load './bayes.rb'
b_obj= Bayes.new
simp_.gender = b_obj.predict(@user.height, @user.weight)
predict_(simp_)
else
if @user.save
redirect_to @user
else
@title = "Train"
render 'new'
end
end
end
...
def predict_(_user)
@user = _user
render 'predicted' ( I am printing @user.gender here)
end
Everything works fine and I am able to use user defined class bayes as well. The problem is that the value stored in ‘simp_.gender’ always remain the same, no matter what my function returns. This is causing a lot of problems.
How should I handle this?
Arun
First double-check the value returned by
b_obj.predict:Try it, then look at the log. If you still need help, edit your question and add information on what was written to the log.