I don’t understand how to use the generated methods as described in the various M:M associations:
others
others=(other,other,...)
other_ids
other_ids=(id,id,...)
In the HMT association like in our post-it app project I need to first create the post and then in a second line of code assign it the category / categories. It would not be possible to assign categories in the same line / query where the object is created. Is this correct?
What is the :autosave option on a has_one, belongs_to, has_many, or has_and_belongs_to_many association
Could you make an example of this: Assigning an object to a has_one association automatically saves that object and the object being replaced (if there is one), in order to update their foreign keys - except if the parent object is unsaved (new_record? == true).
I this syntax: class Blog < ActiveRecord::Base has_many :published_posts, -> { where published: true }, class_name: 'Post' end
I don't udnerstand this part -> { where published: true }, class_name: 'Post'
Could you make an example of this code: record.association(:items).reflection
I do not understand the following example: class Taggable < ActiveRecord::Base belongs_to :post belongs_to :tag, inverse_of: :taggings end
Could you make some examples of Polymorphic associations?