ankane / authtrail

Track Devise login activity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Proposal] Optional on LoginActivity fields

truongnmt opened this issue · comments

Hi there! First, thanks for your awesome work!

I'm using AuthTrail for a while now. To fit my use case, I'm looking for a workaround to:

  1. Delete fields I don't use: city region latitude longitude
    I got this error when delete those fields, obviously:

Error performing AuthTrail::GeocodeJob (Job ID: d7bef36a-5fe6-468f-a70b-79353f11bff9) from Async(default) in 2.55ms: ActiveRecord::StatementInvalid (Mysql2::Error: Unknown column 'city' in 'field list': UPDATE login_activities SET city = NULL, region = NULL, country = 'United States', latitude = 0.0, longitude = 0.0 WHERE login_activities.id = 1):

  1. Add extra custom field(s) to LoginActivity. Other than fields from Devise, we want to save some extra field(s).

What do you think about this? Thanks a lot!

Hey @truongnmt,

  1. Making fields optional sounds good to me. We already do this for geocoding, so happy to accept a PR.
  2. Where are the extra fields populated from? There was a proposal to add extra fields from the request object in #21. It wasn't merged, but happy to revisit.
  1. Sound good to me.
  2. #21 doesn't look really clean, messy I would say. For flexibility I thinking a way to add field(s), not just one, each field have a custom way to retrieve data. Kind of each fields has it proc.

🤔 I'm drafting one anyway

Cleaning up issues, but feel free to submit PRs.

fwiw, there's now a transform_method option on master.

Edit: was released as transform_method (was enrich_method previously)

Wow! Thanks a lot! 💯💯💯