Try here: http://www.slash7.com/pages/vampires
On 5/11/06, Mohammad <name.goes.here44@gmail.com>
wrote:>
> 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.
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060512/b8aca79d/attachment.html