lib/rasti/app/interaction.rb in rasti-app-0.0.3 vs lib/rasti/app/interaction.rb in rasti-app-0.0.4
- old
+ new
@@ -12,26 +12,30 @@
@container = container
@context = context
end
def call(params)
- Thread.current[thread_form_key] = self.class.build_form(params)
+ thread_cache[:form] = self.class.build_form(params)
validate!
execute
ensure
- Thread.current[thread_form_key] = nil
+ thread_cache[:form] = nil
end
private
attr_reader :container, :context
def form
- Thread.current[thread_form_key]
+ thread_cache[:form]
end
- def thread_form_key
- "#{self.class.name}::Form[#{self.object_id}]"
+ def thread_cache
+ Thread.current[thread_cache_key] ||= {}
+ end
+
+ def thread_cache_key
+ "#{self.class.name}[#{self.object_id}]"
end
end
end
end
\ No newline at end of file