I have a model called Organization that has many teams and has many collaborations. A Collaboration also has many teams. So the team model has a polym ...
I have a model called Organization that has many teams and has many collaborations. A Collaboration also has many teams. So the team model has a polym ...
I have the models "Payment", "Estimate" and "Quote", a payment has a polymorphic relationship where it can belong either to a quote or to an estimate, ...
I have 3 models (User, Post, and Comment). User model: Post model: Post migration: Comment model: Comment migration: Note that I have ...
Good day, I'm a bit stuck here with fetching latest item using Laravel scopes and Eloquent Polymorphic One-to-Many relationship. Given: I'm usi ...
From Laravel's docs, the model polymorphism is defined as follows: Polymorphic relations allow a model to belong to more than one other model on a ...
I am trying to find way to get data from a has_and_belongs_to_many association through a secondary model. I'll say sorry now as I might not explain th ...
i have nested resources and i want to allow departments/1/lists, companies/1/lists and goes on, how can i do that? Btw, Im using rails 5 and cancancan ...
I have the following code in my model: Now, is there a way to efficiently write this code: to sum the four lines in one? I have tried the followin ...
The model is a User, which has many Contacts. Posts and Images can be published to Contacts through a ContactPublishment. User has the methods visibl ...
I'm using rails 3.2.8 and i'm having some troubles with polymorphic associations. I have a model activity that it is polymorphic that is related with ...
Having my db setup like this ("type" is always User although I have different kind of User via STI): Postcard model: I'd like to setup the User ...
I am building an application with Rails 3 and MongoDB(mongoid adapter). I am struggling to find the parent records with specific condition in child re ...
I read some relevant questions and tried setting up relationships with has_many :through + polymorphic as below. The migration file for "Authorship ...
I have the following model structure and want to put the user_id in the value associated with an asset. I am having a problem associating a variabl ...
After reading the Ruby on Rails guides and a few of the stackoverflow responses to questions about polymorphic association I understand its use and im ...
I've search everywhere for a pointer to this, but can't find one. Basically, I want to do what everyone else wants to do when they create a polymorphi ...
Here is the thing. I'm working on a web game just for learning and I have this problem. I have a Character who has many items, but the items can be ...
I'm pretty new to Rails, and i'm trying to do a polymorphic HABTM relationship. The problem is that I have three models that I want to relate. The fi ...
Ok so here goes. I don't know if I'm over complicating things or if I'm just still so new to Rails that I don't understand the basics. What I want in ...
I don't know if this is possible, but here goes: What is the relationship I need to be able to call: And have it grab all of the Worm's through ...