Top "Associations" questions

Associations typically refer to relationships between models in ORMs such as ActiveRecord.

Rails has_one :through association

Rails has a has_one :through association that helps set up a one-to-one association with a third model by going …

ruby-on-rails associations rails-activerecord rails-models
add associations to exisiting models

I'm wondering how I can add associations to my models. Suppose, I generate two models rails generate model User rails …

ruby-on-rails migration associations
Rails: ActiveRecord query based on association value

I have 2 models. Report and Server that have a belongs_to and has_many relationship. I created an accessor method …

ruby-on-rails ruby activerecord associations
UML aggregation vs association

Here I am, with another question about aggregation and association. I wanted to learn some basics of UML, so I …

uml associations aggregation
build method on ruby on rails

New to rails and I'm following the Depot project found in the Agile web development with rails 3.1. Everything was fine …

ruby-on-rails ruby-on-rails-3.1 associations
Rails association with multiple foreign keys

I want to be able to use two columns on one table to define a relationship. So using a task …

ruby-on-rails ruby-on-rails-4 associations model-associations
How to create has_and_belongs_to_many associations in Factory girl

Given the following class User < ActiveRecord::Base has_and_belongs_to_many :companies end class Company < ActiveRecord::Base …

ruby-on-rails associations has-and-belongs-to-many factory-bot
How to use ActiveAdmin on models using has_many through association?

I am using ActiveAdmin gem in my project. I have 2 models using has_many through association. The database schema looks …

ruby-on-rails ruby-on-rails-3 rubygems associations activeadmin
The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations

"The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations." I …

c# .net entity-framework-4 associations
Rails - Best-Practice: How to create dependent has_one relations

Could you tell me whats the best practice to create has_one relations? f.e. if i have a user …

ruby-on-rails ruby activerecord ruby-on-rails-3 associations