jimsynz / faye-rails

Simple Rails glue for the Faye messaging protocol.
MIT License
435 stars 79 forks source link

Can not configure model observer #49

Open sanzstez opened 11 years ago

sanzstez commented 11 years ago

Hello. I am trying to make an applications with faye-rails 1.0.7. (with model observers)

I created observer controller RealtimePublicationsController (in app/realtime) with:


  observe Publication, :after_create do |publication|
    RealtimePublicationsController.publish('/publications', "OK")
  end

Some test clientside JS code:


client = new Faye.Client('/faye')
client.subscribe '/publications', (payload)->
  console.log "Client subscribe"

Route.rb:


  resources :publications
  faye_server '/faye', timeout: 25 do
    map '/publications' => RealtimePublicationsController
    map default: :block
  end

After that i start console and write Publication.create({:title => "test"}), and ... get nothing in browser console. What i am doing wrong? Help, please...

melanoma commented 9 years ago

hi, did you ever get around this? thanks