Some error about adding


#1

Ok so I’m trying to make a little exchange 3 for 1 of 1 higher rank here
is the code in the controller:
def exch_link
@id = @session[:user].id
@type = @params[:type]
exch(@id,@type)
end

def exch(user_id,this_type)
@user = User.find(:condtions => "id = " + user_id)
@ranks = [“xw”,“w”,“m”,“l”,“xl”,“s”,“ss”]
if @user.send(this_type) >= 3
@this_type = @ranks.index(this_type)
@nexts_number = @this_type.to_i + 1
@next_type = @ranks[@nexts_number]
@user.send(@next_type) += 1
@user.send(type)
@user.save_with_validation(false)
flash[:notice] = “Exchange complete.”
else
flash[:notice] = “Exchange not met.”
end
redirect_to :action => “upgrade”
end

Here is usage:
<%= link_to ‘exhcange strong for super strong’, :action => “exch_link”,
:type => “s” %> # s is for strong.


#2

Try here: http://www.slash7.com/pages/vampires