That someone who added the item would most probably be a User object. So in MyItem model add
acts_as_activity :user def user_id return the id of the user end I'm not sure if this will work. :D On Thu, Jan 28, 2010 at 9:50 PM, Chris <[email protected]> wrote: > Well, it was working for one of the models and has never worked for > another. The model in question is never going to have a relationship > directly with a user, I was hoping to just track that someone added > the item. > > Is there a better way to do this? > > > On Jan 28, 6:48 am, Jim Ruther Nill <[email protected]> wrote: > > You should have a user_id column for the MyItem table. > > > > On Thu, Jan 28, 2010 at 9:45 PM, Chris <[email protected]> wrote: > > > When I add the acts_as_activity :user to a few of my models, after I > > > try and create a new object, I receive the follow message (My_Item is > > > my example model for this post) > > > > > NoMethodError (undefined method `user_id' for #<My_Item:0x5f4bdd4>): > > > vendor/plugins/community_engine/plugins/activity_tracker/lib/ > > > activity_tracker.rb:60:in `send' > > > vendor/plugins/community_engine/plugins/activity_tracker/lib/ > > > activity_tracker.rb:60:in `create_activity_from_self' > > > vendor/plugins/community_engine/plugins/activity_tracker/lib/ > > > activity_tracker.rb:25:in `acts_as_activity' > > > app/controllers/my_item_controller.rb:78:in `create' > > > app/controllers/my_item_controller.rb:77:in `create' > > > haml (2.2.16) lib/sass/plugin/rails.rb:19:in `process' > > > -e:2:in `load' > > > -e:2 > > > > > Does anyone have an idea, this is happening on a few of my model? > > > > > I have added this to the model > > > > > acts_as_activity :user > > > > > My controller is very simple for create, > > > > > @myitem = MyItem.new(params[:myitem]) > > > > > and then I save it in a respond block. > > > > > Thanks in advance. > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "CommunityEngine" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<communityengine%[email protected]> > <communityengine%[email protected]<communityengine%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/communityengine?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "CommunityEngine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<communityengine%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/communityengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "CommunityEngine" 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/communityengine?hl=en.
