Skip to content

Instantly share code, notes, and snippets.

@sineed
sineed / ams.rb
Last active June 10, 2020 15:42
Upgrade AMS from 0.9.0 to 0.10.0
module AMS
module V09
class Serializer < ActiveModel::Serializer
def serializable_hash(adapter_options = nil,
options = {},
adapter_instance = self.class.serialization_adapter_instance)
object.nil? ? nil : super
end
end
@sineed
sineed / nested_attributes_for_strategy.rb
Created February 28, 2014 08:29
FactoryGirl.nested_attributes_for(your_ar_factory_with_nested_attributes)
class NestedAttributesForStrategy
def association(runner)
runner.run
end
def result(evaluation)
evaluation.object.tap do |instance|
evaluation.notify(:after_build, instance)
return attributes(instance)
end