How to use increment_counter in model

Hi,

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??

Thanks for reading.

–Dan W.

Oh, I forgot to mention 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.

–Dan W.

Daniel Wozniak wrote:

Hi,

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??

Thanks for reading.

–Dan W.