Forum: Ruby on Rails Some error about adding.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mohammad (Guest)
on 2006-05-12 05:47
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]

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
 flash[:notice] = "Exchange complete."
 flash[:notice] = "Exchange not met."
redirect_to :action => "upgrade"

Here is usage:
<%= link_to 'exhcange strong for super strong', :action => "exch_link",
:type => "s" %> # s is for strong.
Steve L. (Guest)
on 2006-05-12 06:15
(Received via mailing list)
This topic is locked and can not be replied to.