Sha256: 8be82c09aabe015b50e28dbc3b5ac7d61d8d054edee9955a09dd82394488f16f
Contents?: true
Size: 619 Bytes
Versions: 1
Compression:
Stored size: 619 Bytes
Contents
module RenderSync class RefetchModel def self.find_by_class_name_and_id(resource_name, id) class_name = resource_name.to_s.classify class_name.safe_constantize.find(id) if supported_classes.include?(class_name) rescue nil end def self.supported_classes Thread.current["sync_refetch_classes"] = nil if Rails.env.development? Thread.current["sync_refetch_classes"] ||= begin Dir["app/views/sync/*/refetch"].collect{|path| File.basename(path.gsub(/\/refetch$/, '')).classify }.reject{|clazz| clazz.nil? } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
render_sync-0.5.0 | lib/render_sync/refetch_model.rb |