D
Dan W.
Hi, i'm trying to get my ChrissMonster model to pull back the value of
"eat" in the chriss_monster table and increment the value by 1.
Here's my controller function:def feed
@chriss_monster = ChrissMonster.find(params[:id])
@chriss_monster.feed
redirect_to :action => 'list'
end
<<<
Here's my model:class ChrissMonster < ActiveRecord::Base
def feed
ChrissMonster.increment_counter :eat, :id
end
end
<<<
When I call the controller function, it directs me back to the list
page, it doesn't give me an error, and it does NOT increment the "eat"
value.
What am I doing wrong? How else could I rewrite this?
Thanks for reading!
--Dan W.
"eat" in the chriss_monster table and increment the value by 1.
Here's my controller function:def feed
@chriss_monster = ChrissMonster.find(params[:id])
@chriss_monster.feed
redirect_to :action => 'list'
end
<<<
Here's my model:class ChrissMonster < ActiveRecord::Base
def feed
ChrissMonster.increment_counter :eat, :id
end
end
<<<
When I call the controller function, it directs me back to the list
page, it doesn't give me an error, and it does NOT increment the "eat"
value.
What am I doing wrong? How else could I rewrite this?
Thanks for reading!
--Dan W.