Sha256: f59577bb4d11fe14d3473b60af2fb6bec9f1081f0b32d167b2fcbf640c9b0fff
Contents?: true
Size: 589 Bytes
Versions: 4
Compression:
Stored size: 589 Bytes
Contents
class NestedFormsModel include TransForms::NestedForms::Active # Makes the methods public for easier Unit testing public :each_nested_hash_for, :any_nested_hash_for?, :find_from! end class UserAndPoneNumbersCreator < TransForms::FormBase has_nested_forms attr_reader :user attribute :name, String attribute :phone_numbers_attributes, Hash validates :name, presence: true transaction do @user = User.create!(name: name) each_nested_hash_for phone_numbers_attributes do |attr| @user.phone_numbers.create!(attr) end end end
Version data entries
4 entries across 4 versions & 1 rubygems