开发者

Rails assoication

开发者 https://www.devze.com 2023-03-09 01:16 出处:网络
In rails : I Need to save every activity of any model which are associated with One Model. For example:

In rails :

I Need to save every activity of any model which are associated with One Model.

For example:

I have a User model that is associated with some others model.Then if any updatio开发者_StackOverflow社区n ,insertion or select query fire on those models,It will be save as a activity in activity_log model, this table has a foreign key of user id .

Please give me idea how it can be possible without writing a function in ApplicationController

Thanks in advance for any guidance.


i don't know much about it, but i think you can use "active record callbacks". here is the link http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html


There are a few existing solutions that you can build on:

  • Activity
  • acts_as_protocolable
  • activity_stream
0

精彩评论

暂无评论...
验证码 换一张
取 消