accepts_nested_attributes_for in one of my models and want to handle the nested attribute (photos) in my Administrate form. It doesn't appear that administrate handles the nested association out-the-box. I've tried using https://github.com/nickcharlton/administrate-field-nested_has_many but I get the following error:
uninitialized constant Administrate::Field::NestedHasMany
Perhaps it's not compatible with the Jumpstart Administrate version?
What's the preferred approach for handling
accepts_nested_attributes_for with Administrate, can someone advise?
I need some help figuring out how I should associate my models.
I have three models:
class Series < ApplicationRecord has_many :modules has_many :episodes end
class Module < ApplicationRecord belongs_to :series has_many :episodes end
class Episode < ApplicationRecord belongs_to :modules, optional: true belongs_to :series, optional: true end
I need to be able to manually specify the order of the following has_many relationships:
- Module in a Series
- Episode in a Module
- Episode in a Series.
I believe I need a
has_many, through:, possibly 3 of them? One for each relationship, so
class Series < ApplicationRecord has_many :modules, through: :module_series has_many :episodes, through: :episode_series end
class Module < ApplicationRecord belongs_to :series has_many :episodes, through: module_episode end
Am i approaching this the correct way?