Re: Of Models and Controllers

Steven
Thu, 18 Aug 2005 00:16:06 -0000

On Thu, 2005-08-18 at 00:32 +0200, Johan Svensson wrote:
> The method in the Player model is very simple until I can get it working:
>
> 	def give_points(target, pts)
> 		target.points += pts
> 		# No failsafe checks here yet
> 		target.save
> 	end

I think it seems odd to want to pass the target in when you can simply
do something like

def give_points(pts)
	# maybe a check for error input on pts.
	self.points += pts
	self.save
end


And in your controller you would do something like

target = Player.find(tgt)
target.give_points(pts)

--
Steven Critchfield
critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org
KI4KTY