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.
0a36dd2d45a8cead5dcfd27a9346f620?d=identicon&s=25 Mohammad (Guest)
on 2006-05-12 03: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.
5ce55767684e0cd1727db2b8b8975640?d=identicon&s=25 Steve Longdo (Guest)
on 2006-05-12 04:15
(Received via mailing list)
This topic is locked and can not be replied to.