Comments (5)
He doesn't want to pick a particular user, he wants to use a different model completely. He is not tracking users, he is tracking subscribers. I too have a Subscriber model that I wish to track. As mentioned before, mailkick handles this perfectly but I cannot seem to do it with this gem.
from ahoy_email.
@ollieglass user is polymorphic, so it already supports any user model. https://github.com/ankane/ahoy_email/blob/master/app/models/ahoy/message.rb#L5
from ahoy_email.
I see... so I say my model (Subscriber) has_many :messages, as: :user
... and that won't conflict with another model called User?
Won't this line require the model to be called User?
Line 24 in 6a7d42b
Sorry if I'm not getting it!
from ahoy_email.
@ollieglass that shouldn't be an issue, although the naming of this polymorphic relationship is rather awkward. And yes, your semantics are correct there. Although I'd worry about using this on a Subscriber
class when you also have a User
class. Things could get awkward pretty quickly.
You wonder if something like: belongs_to :messageable, polymorphic: true
wouldn't be better, in which case you could include a global override to specify the model of your choice.
I just think it's weird to technically have a User
class that also has a "User"
for its user_type
. :)
from ahoy_email.
@ollieglass that's the default user
option, but you can pass whatever you'd like to track user: any_user
.
from ahoy_email.
Related Issues (20)
- TypeError - no implicit conversion of nil into String HOT 1
- Api only application HOT 2
- User model is available but not set in Ahoy::Message HOT 4
- How to store or replay the message body? HOT 3
- Catch (SMTP) errors when sending e-mails HOT 3
- Open Tracking - triggering multiple times? HOT 2
- Filtering false opens HOT 3
- Plan HOT 1
- Instance model HOT 3
- Use RuboCop? HOT 2
- [Idea] Classify mails on basis other than users
- Url link is not consistent with hash signature HOT 2
- PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block HOT 2
- Track utm_params breaks links with nested content HOT 2
- Proper way to globally set user mapping logic? HOT 4
- Bring back open tracking HOT 1
- Allow redirections to other/external hosts for click event HOT 3
- Extra data not saving in Ahoy::Message table while using instance variables HOT 5
- "Link expired" for all links in the email HOT 3
- Email link for CLICK ANALYTICS throws 404 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ahoy_email.