Top "Associations" questions

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

Rails 4: How to use includes() with where() to retrieve associated objects

I can't figure out how to user the .where() method to retrieve associated model data. In this example, Projects belongs_…

ruby-on-rails ruby associations ruby-on-rails-4
belongs_to with :class_name option fails

I have no idea what went wrong but I can't get belongs_to work with :class_name option. Could somebody …

ruby-on-rails activerecord associations
is it recommended to make associations to enum classes in uml class diagram?

I am designing a class diagram and I got a doubt: I have a class which have several attributes refering …

class enums uml associations diagram
When will ActiveRecord save associations?

1) I know that it will save associations when autosave: true as per http://railsapi.com/doc/rails-v2.3.8/classes/ActiveRecord/AutosaveAssociation.…

ruby-on-rails activerecord associations has-many
Rails 4 find or create by method doesn't work

I have a one to many association between jobs and companies and it works fine. In the job form view …

ruby-on-rails ruby-on-rails-4 associations
Ruby-on-Rails: Multiple has_many :through possible?

Is it possible to have multiple has_many :through relationships that pass through each other in Rails? I received the …

ruby-on-rails associations has-many-through
Correct way of testing "associations" with Rspec?

I am trying to test the following scenario: -> I have a model called Team which it just makes …

ruby-on-rails rspec associations
Sails.js populate nested associations

I've got myself a question regarding associations in Sails.js version 0.10-rc5. I've been building an app in which multiple …

node.js associations sails.js populate nested
Getting fields_for and accepts_nested_attributes_for to work with a belongs_to relationship

I cannot seem to get a nested form to generate in a rails view for a belongs_to relationship using …

ruby-on-rails ruby associations nested-attributes
Validation failed Class must exist

I have been (hours) trouble with associations in Rails. I found a lot of similar problems, but I couldn't apply …

ruby-on-rails validation associations model-associations belongs-to