lundi 22 mai 2017

Rails how create association in the model before or after create?

i'm using a callback to create a association but after the creation did not associate

Someone have any hint how associate in the model instead of in the controller?

class Open < ActiveRecord::Base
after_create :images_build

  def images_build
    images.build

    true
  end
end

Aucun commentaire:

Enregistrer un commentaire