I have two models:

Items
-id
-name
-created_by (links to user id)
...

Users
-id
-name
-items_count
...

item.rb:
belongs_to :user, :class_name => 'User', :foreign_key => 'created_by',
:counter_cache => true

user.rb:
has_many :items, :foreign_key => 'created_by'

---------------------------------------------

is this all i need to have it increment the User.items_count field
everytime a new item is created?  I'm not getting any error messages but
it's not updating the field.

can someone shed some light?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to