public
Description: Simple log utility for models. Add any number of optional arbitrary details fields, or user_id.
Clone URL: git://github.com/darcy/acts_as_loggable.git
Search Repo:
Updated incredibly incorrect README instructions
:
darcy (author)
Wed Apr 23 08:16:23 -0700 2008
commit  e5bdb7faea7185f06a2e242a2924b01b279dd4be
tree    569599e3c0759b53c3066e6e0fa1d7792bde7bdb
parent  9746cf31222b999135b7f260a229d510d49793f5
0
...
11
12
13
14
15
16
 
 
 
 
17
18
19
 
 
20
21
22
...
11
12
13
 
 
 
14
15
16
17
18
 
 
19
20
21
22
23
0
@@ -11,12 +11,13 @@
0
   ...
0
 end
0
 
0
-o = Order.find(1)
0
-log_details = {:transaction_id => "TX1234", :test => false, :foo => "bar"}
0
-o.logs << Log.new("Credit Card Aprroved", log_details)
0
+o = Order.find(:first)
0
+log = Log.new(:message => "Credit Card Aprroved")
0
+log.details = [["transaction_id","TX1234"],["test",false],["foo","bar"]]
0
+o.logs << log
0
 o.logs.first.message # => "Credit Card Aprroved"
0
-o.logs.first.details.first.label => "transaction_id"
0
-o.logs.first.details.first.text => "TX1234"
0
+o.logs.first.details.first.label # => "transaction_id"
0
+o.logs.first.details.first.detail # => "TX1234"
0
 
0
 Details are optional, also, pass a user_id to log the user_id, then o.logs.find_by_user(current_user), etc...
0
 

Comments

    No one has commented yet.