class RenderSync::RefetchPartial
Public Class Methods
all(model, context, scope = nil)
click to toggle source
# File lib/render_sync/refetch_partial.rb, line 4 def self.all(model, context, scope = nil) resource = Resource.new(model) Dir["#{RenderSync.views_root}/#{resource.plural_name}/refetch/_*.*"].map do |partial| partial_name = File.basename(partial) RefetchPartial.new(partial_name[1...partial_name.index('.')], resource.model, scope, context) end end
find(model, partial_name, context)
click to toggle source
# File lib/render_sync/refetch_partial.rb, line 13 def self.find(model, partial_name, context) resource = Resource.new(model) plural_name = resource.plural_name partial = Dir["#{RenderSync.views_root}/#{plural_name}/refetch/_#{partial_name}.*"].first return unless partial RefetchPartial.new(partial_name, resource.model, nil, context) end
Public Instance Methods
creator_for_scope(scope)
click to toggle source
# File lib/render_sync/refetch_partial.rb, line 32 def creator_for_scope(scope) RefetchPartialCreator.new(name, resource.model, scope, context) end
message(action)
click to toggle source
# File lib/render_sync/refetch_partial.rb, line 28 def message(action) RenderSync.client.build_message channel_for_action(action), refetch: true end
Private Instance Methods
path()
click to toggle source
# File lib/render_sync/refetch_partial.rb, line 39 def path "sync/#{resource.plural_name}/refetch/#{name}" end