class CollabDocumentChannel

Public Instance Methods

commit(data) click to toggle source
Calls superclass method Collab::Channel#commit
# File lib/generators/collab/install/templates/channel.rb, line 4
def commit(data)
  if false # replace with your own authorization logic
    raise "authorization not implemented"
  end

  super # make sure to call super in order to process the commit
end

Private Instance Methods

find_document() click to toggle source

Find the document to subscribe to based on the params passed to the channel Authorization may also be performed here (raise an error to prevent subscription)

# File lib/generators/collab/install/templates/channel.rb, line 16
def find_document
  Collab::Models::Document.find(params[:document_id]).tap do |document|
    # TODO: Replace with your own authorization logic
    reject_unauthorized_connection
  end
end