I'm trying to use Public_activity gem with parameters.
on my console:
c = PublicActivity::Activity.find(34)
PublicActivity::Activity Load (0.2ms) SELECT "events".* FROM "events" WHERE
"events"."id" = ? LIMIT 1 [["id", 34]]
=> #<PublicActivity::Activity id: 34, trackable_id: 17, trackable_type: "Follow", owner_id: 2, owner_type: "User", key: "follow.destroy", parameters: {:notif=>"on"}, recipient_id: nil, recipient_type: nil, created_at: "2014-08-15 04:44:03", updated_at: "2014-08-15 04:44:03">
How do I search in PublicActivity::Activity.all to find the one record with parameters[:notif] = "on" ?
Actually my question is much simpler...how do I use an Active Record Query to find a particular records with a hash! ?
The gem owner suggests adding a custom field. Via: https://github.com/pokonski/public_activity#use-custom-fields-on-activity
To add a custom field:
Add your custom field to the activities table:
Assign custom field in the model:
Now you can use a query to find activity records where
notif: on