Top "Has-many" questions

has_many indicates a master-detail relationship.

Rails has_many with alias name

In my User model I could have: has_many :tasks and in my Task model: belongs_to :user Then, supposing …

ruby-on-rails has-many
Use a scope by default on a Rails has_many relationship

Let's say I have the following classes class SolarSystem < ActiveRecord::Base has_many :planets end class Planet < ActiveRecord::…

ruby-on-rails-3 activerecord has-many
Rails find record with zero has_many records associated

This seems fairly simple but I can't get it to turn up on Google. If I have: class City < …

sql ruby-on-rails activerecord has-many
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 has_many :through Find by Extra Attributes in Join Model

New to both Ruby and Rails but I'm book educated by now (which apparently means nothing, haha). I've got two …

ruby-on-rails ruby has-many has-many-through
Validate the number of has_many items in Ruby on Rails

Users can add tags to a snippet: class Snippet < ActiveRecord::Base # Relationships has_many :taggings has_many :tags, :through =&…

ruby-on-rails validation tagging has-many
Rails RSpec Tests for a has_many :through Relationship

I'm new to testing and rails but i'm trying to get my TDD process down properly. I was wondering if …

ruby-on-rails ruby rspec has-many has-many-through
How to use constant in the ON condition in Yii2 hasMany relation

I try to create a polymorphic association, what is common in Rails but unfortunately not in Yii2. As part of …

yii2 has-many polymorphic-associations relation
Rails Model has_many with multiple foreign_keys

Relatively new to rails and trying to model a very simple family "tree" with a single Person model that has …

ruby-on-rails ruby model has-many
ActiveAdmin with has_many problem; undefined method 'new_record?'

I'm trying to customise a ActiveAdmin form for a Recipe model that has a has_many relationship with Step. class …

ruby-on-rails admin has-many formtastic activeadmin