0
у меня есть следующие моделиупорядочены по атрибуту ребенка, в полиморфном полиморфном ассоциации
class Airplane < ActiveRecord::Base
has_many :airtags
has_many :pictures, :through => :airtags
end
class Airtag < ActiveRecord::Base
attr_accessible :airable_type, :airable_id, :airplane_id
belongs_to :airplane
belongs_to :airable, :polymorphic => true
end
class Picture < ActiveRecord::Base
belongs_to :picturable, :polymorphic => true
has_many :airtags, :as => :airable, :dependent => :destroy
has_many :airplanes, :through => :airtags
end
в моем самолете шоу, я хочу, чтобы перечислить все фотографии, упорядоченные по имени.
дает мне эту ошибку Не удалось найти источник ассоциации (ы): картина или: фотографии в модели Airtag. Попробуйте 'has_many: pictures,: through =>: airtags,: source =>'. Это один из: самолет или: желательно? –
malice
, если я отредактирую его до: \t has_many: pictures,: through =>: airtags,: source =>: airable я получаю: не могу иметь has_many: через ассоциацию 'Airplane # pictures' на полиморфном объекте 'Airable # airable'. – malice
add has_many: картинки для модели Airtag – gayavat